summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xdist-assets/pkg-scripts/postinstall12
-rwxr-xr-xdist-assets/pkg-scripts/preinstall11
2 files changed, 20 insertions, 3 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index d4c42a6059..9ef4822b5f 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -2,6 +2,16 @@
set -eu
+INSTALL_DIR=$2
+
+# Workaround for issue in electron-builder where the pkg-scripts are run twice, once with the
+# correct install dir and once with an incorrect one. This guard prevents running the script when
+# called the second time. This can be reverted when the following issue has been fixed:
+# https://github.com/electron-userland/electron-builder/issues/8166
+if [[ $INSTALL_DIR == *"Mullvad VPN.app" ]]; then
+ exit 0
+fi
+
LOG_DIR=/var/log/mullvad-vpn
mkdir -p $LOG_DIR
@@ -9,8 +19,6 @@ exec > $LOG_DIR/postinstall.log 2>&1
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
diff --git a/dist-assets/pkg-scripts/preinstall b/dist-assets/pkg-scripts/preinstall
index c7b1cf13fb..1b61ff3ed5 100755
--- a/dist-assets/pkg-scripts/preinstall
+++ b/dist-assets/pkg-scripts/preinstall
@@ -2,9 +2,18 @@
set -eux
-LOG_DIR=/var/log/mullvad-vpn
INSTALL_DIR=$2
+# Workaround for issue in electron-builder where the pkg-scripts are run twice, once with the
+# correct install dir and once with an incorrect one. This guard prevents running the script when
+# called the second time. This can be reverted when the following issue has been fixed:
+# https://github.com/electron-userland/electron-builder/issues/8166
+if [[ $INSTALL_DIR == *"Mullvad VPN.app" ]]; then
+ exit 0
+fi
+
+LOG_DIR=/var/log/mullvad-vpn
+
mkdir -p $LOG_DIR
chmod 755 $LOG_DIR
exec > $LOG_DIR/preinstall.log 2>&1