[packaging] Add migration for linux installers

This commit is contained in:
Vladimir Stoilov 2025-03-05 16:13:00 +02:00
parent d74083ced8
commit df6e95dcd7
No known key found for this signature in database
4 changed files with 76 additions and 3 deletions
desktop/tauri/src-tauri/gen/schemas
packaging/linux
service

View file

@ -1100,6 +1100,11 @@
"type": "string",
"const": "core:webview:allow-reparent"
},
{
"description": "Enables the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-set-webview-background-color"
},
{
"description": "Enables the set_webview_focus command without any pre-configured scope.",
"type": "string",
@ -1180,6 +1185,11 @@
"type": "string",
"const": "core:webview:deny-reparent"
},
{
"description": "Denies the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-set-webview-background-color"
},
{
"description": "Denies the set_webview_focus command without any pre-configured scope.",
"type": "string",
@ -1395,6 +1405,21 @@
"type": "string",
"const": "core:window:allow-set-always-on-top"
},
{
"description": "Enables the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-background-color"
},
{
"description": "Enables the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-count"
},
{
"description": "Enables the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-label"
},
{
"description": "Enables the set_closable command without any pre-configured scope.",
"type": "string",
@ -1480,6 +1505,11 @@
"type": "string",
"const": "core:window:allow-set-minimizable"
},
{
"description": "Enables the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-overlay-icon"
},
{
"description": "Enables the set_position command without any pre-configured scope.",
"type": "string",
@ -1740,6 +1770,21 @@
"type": "string",
"const": "core:window:deny-set-always-on-top"
},
{
"description": "Denies the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-background-color"
},
{
"description": "Denies the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-count"
},
{
"description": "Denies the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-label"
},
{
"description": "Denies the set_closable command without any pre-configured scope.",
"type": "string",
@ -1825,6 +1870,11 @@
"type": "string",
"const": "core:window:deny-set-minimizable"
},
{
"description": "Denies the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-overlay-icon"
},
{
"description": "Denies the set_position command without any pre-configured scope.",
"type": "string",

View file

@ -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

View file

@ -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"

View file

@ -35,7 +35,7 @@ func (sc *ServiceConfig) Init() error {
if sc.BinDir == "" {
exeDir, err := getCurrentBinaryFolder() // Default: C:/Program Files/Portmaster
if err != nil {
return fmt.Errorf("derive bin dir from runnning exe: %w", err)
return fmt.Errorf("derive bin dir from running exe: %w", err)
}
sc.BinDir = exeDir
}