diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-04-24 12:08:05 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-04-25 10:06:16 +0200 |
| commit | 0bd70fbeac85492503592202fd118d6e90199769 (patch) | |
| tree | 55b72e1f569f31cd7b3ffe3f415db3b841b3f31c | |
| parent | c16ef1f7ca74b60e18ee9f4090e3312a795fac0b (diff) | |
| download | mullvadvpn-0bd70fbeac85492503592202fd118d6e90199769.tar.xz mullvadvpn-0bd70fbeac85492503592202fd118d6e90199769.zip | |
Add guard to prevent running preinstall and postinstall a second time
| -rwxr-xr-x | dist-assets/pkg-scripts/postinstall | 12 | ||||
| -rwxr-xr-x | dist-assets/pkg-scripts/preinstall | 11 |
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 |
