[packaging] Add migration for linux installers
This commit is contained in:
@@ -34,7 +34,7 @@ AmbientCapabilities=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_ne
|
||||
CapabilityBoundingSet=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_net_broadcast cap_net_raw cap_sys_module cap_sys_ptrace cap_dac_override cap_fowner cap_fsetid cap_sys_resource cap_bpf cap_perfmon
|
||||
StateDirectory=portmaster
|
||||
# TODO(ppacher): add --disable-software-updates once it's merged and the release process changed.
|
||||
WorkingDirectory=/var/lib/portmaster/data
|
||||
WorkingDirectory=/var/lib/portmaster
|
||||
ExecStart=/usr/lib/portmaster/portmaster-core --log-dir=/var/lib/portmaster/log -- $PORTMASTER_ARGS
|
||||
ExecStopPost=-/usr/lib/portmaster/portmaster-core -recover-iptables
|
||||
|
||||
|
||||
@@ -11,10 +11,33 @@ if command -V semanage >/dev/null 2>&1; then
|
||||
restorecon -R /usr/lib/portmaster/portmaster-core 2>/dev/null >&2 || :
|
||||
fi
|
||||
|
||||
# Migration from v1
|
||||
OLD_INSTALLATION_DIR="/opt/safing/portmaster"
|
||||
MIGRATED_FILE_FLAG="$OLD_INSTALLATION_DIR/migrated.txt"
|
||||
|
||||
if [ ! -e "$MIGRATED_FILE_FLAG" ]; then
|
||||
echo "Starting migration form v1"
|
||||
|
||||
# Becoause the service file need to change path, first the links to the old service needs to be removed.
|
||||
systemctl stop portmaster.service
|
||||
systemctl disable portmaster.service
|
||||
|
||||
# Migrate config
|
||||
cp -r $OLD_INSTALLATION_DIR/databases /var/lib/portmaster
|
||||
cp -r $OLD_INSTALLATION_DIR/config.json /var/lib/portmaster/config.json
|
||||
|
||||
# Remove shortcut
|
||||
rm /etc/xdg/autostart/portmaster_notifier.desktop
|
||||
rm /usr/share/applications/portmaster_notifier.desktop
|
||||
|
||||
touch $MIGRATED_FILE_FLAG
|
||||
echo "Migration complete"
|
||||
fi
|
||||
|
||||
mv /usr/bin/portmaster /usr/lib/portmaster/portmaster
|
||||
ln -s /usr/lib/portmaster/portmaster /usr/bin/portmaster
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable portmaster.service
|
||||
|
||||
echo "Please reboot your system"
|
||||
echo "Please reboot your system"
|
||||
|
||||
Reference in New Issue
Block a user