-
Notifications
You must be signed in to change notification settings - Fork 0
/
mullvad-vpn.install
52 lines (41 loc) · 1.39 KB
/
mullvad-vpn.install
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
pre_install() {
if systemctl status mullvad-daemon &> /dev/null; then
echo 'Stopping & disabling Mullvad VPN daemon...'
/opt/Mullvad\ VPN/resources/mullvad-setup prepare-restart || true
systemctl disable --now mullvad-daemon
fi
pkill -x "mullvad-gui" || true
rm -f /var/cache/mullvad-vpn/relays.json || true
}
post_install() {
chmod u+s "/usr/bin/mullvad-exclude"
echo 'Enabling Mullvad VPN daemon...'
systemctl enable --now mullvad-daemon
}
pre_upgrade() {
pre_install
}
post_upgrade() {
echo 'Starting & enabling Mullvad VPN daemon...'
systemctl daemon-reload
systemctl enable --now mullvad-daemon
chmod u+s "/usr/bin/mullvad-exclude"
}
pre_remove() {
/usr/bin/mullvad account clear-history || echo "Failed to remove leftover WireGuard keys"
# the user might've disabled or stopped the service themselves already
echo 'Making sure the Mullvad VPN daemon is stopped & disabled...'
systemctl stop mullvad-daemon || true
systemctl disable mullvad-daemon || true
/opt/Mullvad\ VPN/resources/mullvad-setup reset-firewall || true
}
post_remove() {
echo -------------------------------------------------------------
echo 'Optionally remove logs & cache:'
echo 'sudo rm -rf /var/log/mullvad-vpn/'
echo 'sudo rm -rf /var/cache/mullvad-vpn/'
echo ''
echo 'Optionally remove config:'
echo 'sudo rm -rf /etc/mullvad-vpn'
echo -------------------------------------------------------------
}