blob: ef6d953970f915de8a331f15942808842b8712e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env bash
set -eux
LOG_DIR=/var/log/mullvad-vpn
INSTALL_DIR=$2
mkdir -p $LOG_DIR
chmod 755 $LOG_DIR
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"
# Migrate cache files from <=2020.8-beta2 paths
OLD_CACHE_DIR="/var/root/Library/Caches/mullvad-vpn"
NEW_CACHE_DIR="/Library/Caches/mullvad-vpn"
if [ -d "$OLD_CACHE_DIR" ]; then
echo "Found old cache dir at $OLD_CACHE_DIR, moving to $NEW_CACHE_DIR"
mkdir -p "$NEW_CACHE_DIR"
mv "$OLD_CACHE_DIR"/* "$NEW_CACHE_DIR/" || echo "Unable to migrate cache. No cache files?"
rm -rf "$OLD_CACHE_DIR"
fi
# Remove the existing relay and API address cache lists.
# There is a risk that they're incompatible with the format this version wants
rm "$NEW_CACHE_DIR/relays.json" || true
rm "$NEW_CACHE_DIR/api-ip-address.txt" || true
|