summaryrefslogtreecommitdiffhomepage
path: root/dist-assets/pkg-scripts
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2023-05-16 16:31:04 +0200
committerDavid Lönnhager <david.l@mullvad.net>2023-05-23 09:59:36 +0200
commit124ebaae1447da30aab1f5385f200f2de535de1b (patch)
treedaff040e04513a0dabb1f02a7a55094541ff4110 /dist-assets/pkg-scripts
parent520d35245f59fe36463d0170645bde8832d8ccf5 (diff)
downloadmullvadvpn-124ebaae1447da30aab1f5385f200f2de535de1b.tar.xz
mullvadvpn-124ebaae1447da30aab1f5385f200f2de535de1b.zip
Run new CLI before stopping old daemon
Diffstat (limited to 'dist-assets/pkg-scripts')
-rwxr-xr-xdist-assets/pkg-scripts/postinstall10
-rwxr-xr-xdist-assets/pkg-scripts/preinstall6
2 files changed, 13 insertions, 3 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index 716bc2b2e6..b91cd8a4e4 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -10,6 +10,16 @@ exec 2>&1 > $LOG_DIR/postinstall.log
echo "Running postinstall at $(date)"
INSTALL_DIR=$2
+
+# Run CLI to force macOS to check the certificate, and shut down the already running daemon, if one
+# exists.
+# This is a temporary workaround. After 2023.3, we switched from signing with Amagicom AB to
+# Mullvad VPN AB certificates. This could potentially be removed when older versions are no longer
+# supported.
+"$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad" || true
+"$TMPDIR/mullvad-setup" prepare-restart || \
+ echo "Failed to send 'prepare-restart' command to old mullvad-daemon"
+
# NOTE: This path must be kept in sync with the path defined
# in mullvad-daemon/src/macos_launch_daemon.rs
DAEMON_PLIST_PATH="/Library/LaunchDaemons/net.mullvad.daemon.plist"
diff --git a/dist-assets/pkg-scripts/preinstall b/dist-assets/pkg-scripts/preinstall
index 1bf437a9ff..93d88d6271 100755
--- a/dist-assets/pkg-scripts/preinstall
+++ b/dist-assets/pkg-scripts/preinstall
@@ -11,9 +11,9 @@ exec 2>&1 > $LOG_DIR/preinstall.log
echo "Running preinstall at $(date)"
-# Notify the running daemon that we are going to kill it and replace it with a newer version.
-"$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad-setup" prepare-restart || \
- echo "Failed to send 'prepare-restart' command to old mullvad-daemon"
+# We need to run this is after extracting the new files and running "mullvad" in postinstall rather
+# than in preinstall.
+cp "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad-setup" "$TMPDIR/" || echo "Failed to copy mullvad-setup"
# Migrate cache files from <=2020.8-beta2 paths
OLD_CACHE_DIR="/var/root/Library/Caches/mullvad-vpn"