From 8c8579b3f66151d2dc052dc0d4c54a5c44b351e0 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Thu, 23 Apr 2026 15:25:50 +0200 Subject: [PATCH] Move systemd stuff out of pre-deinstall --- mullvad-vpn-daemon/APKBUILD | 3 ++- .../mullvad-vpn-daemon-systemd.pre-deinstall | 8 ++++++++ mullvad-vpn-daemon/mullvad-vpn-daemon.post-install | 2 +- mullvad-vpn-daemon/mullvad-vpn-daemon.post-upgrade | 7 ++++--- mullvad-vpn-daemon/mullvad-vpn-daemon.pre-deinstall | 6 ------ 5 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 mullvad-vpn-daemon/mullvad-vpn-daemon-systemd.pre-deinstall diff --git a/mullvad-vpn-daemon/APKBUILD b/mullvad-vpn-daemon/APKBUILD index a794f1a..4a41395 100644 --- a/mullvad-vpn-daemon/APKBUILD +++ b/mullvad-vpn-daemon/APKBUILD @@ -28,8 +28,9 @@ install=" $pkgname.post-upgrade $pkgname.pre-deinstall $pkgname.post-deinstall - $pkgname-systemd.post-install + $pkgname-systemd.post-install $pkgname-systemd.post-upgrade + $pkgname-systemd.pre-deinstall " subpackages=" $pkgname-systemd diff --git a/mullvad-vpn-daemon/mullvad-vpn-daemon-systemd.pre-deinstall b/mullvad-vpn-daemon/mullvad-vpn-daemon-systemd.pre-deinstall new file mode 100644 index 0000000..b1a0dde --- /dev/null +++ b/mullvad-vpn-daemon/mullvad-vpn-daemon-systemd.pre-deinstall @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu + +# Stop and disable all mullvad services +systemctl stop mullvad-daemon.service || true +systemctl disable mullvad-daemon.service || true +systemctl stop mullvad-early-boot-blocking.service || true +systemctl disable mullvad-early-boot-blocking.service || true diff --git a/mullvad-vpn-daemon/mullvad-vpn-daemon.post-install b/mullvad-vpn-daemon/mullvad-vpn-daemon.post-install index ec08ab4..38c0115 100644 --- a/mullvad-vpn-daemon/mullvad-vpn-daemon.post-install +++ b/mullvad-vpn-daemon/mullvad-vpn-daemon.post-install @@ -1,7 +1,7 @@ #!/bin/sh set -eu -# Overwrite the cached relay list with the one embedded in the package. +# Copy vendored relay list into place mkdir -p /var/cache/mullvad-vpn \ && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \ || echo "failed to install /var/cache/mullvad-vpn/relays.json" diff --git a/mullvad-vpn-daemon/mullvad-vpn-daemon.post-upgrade b/mullvad-vpn-daemon/mullvad-vpn-daemon.post-upgrade index c7ddd4f..e00ead1 100644 --- a/mullvad-vpn-daemon/mullvad-vpn-daemon.post-upgrade +++ b/mullvad-vpn-daemon/mullvad-vpn-daemon.post-upgrade @@ -1,6 +1,7 @@ #!/bin/sh set -eu -# Overwrite the cached relay list with the one embedded in the package. -mkdir /var/cache/mullvad-vpn -cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json +# Overwrite the cached relay list with the vendored one. +mkdir -p /var/cache/mullvad-vpn \ + && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \ + || echo "failed to install /var/cache/mullvad-vpn/relays.json" diff --git a/mullvad-vpn-daemon/mullvad-vpn-daemon.pre-deinstall b/mullvad-vpn-daemon/mullvad-vpn-daemon.pre-deinstall index a554b0e..10004b3 100644 --- a/mullvad-vpn-daemon/mullvad-vpn-daemon.pre-deinstall +++ b/mullvad-vpn-daemon/mullvad-vpn-daemon.pre-deinstall @@ -1,11 +1,5 @@ #!/bin/sh set -eu -# the user might've disabled or stopped the service themselves already -systemctl stop mullvad-daemon.service || true -systemctl disable mullvad-daemon.service || true -systemctl stop mullvad-early-boot-blocking.service || true -systemctl disable mullvad-early-boot-blocking.service || true - mullvad-setup reset-firewall || echo "Failed to reset firewall" mullvad-setup remove-device || echo "Failed to remove device from account"