summaryrefslogtreecommitdiffhomepage
path: root/dist-assets/linux/after-install.sh
blob: 7701202b464a798d601a331d81c2eabe0c90a282 (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
#!/usr/bin/env bash
set -eu

chmod u+s "/usr/bin/mullvad-exclude"

systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"

# return 0 if version $1 is greater than or equal to $2
function version_is_ge {
    [ "$1" = "$2" ] && return 0
    printf '%s\n' "$2" "$1" | sort -C -V
}

# Ubuntu 24.04 or newer: Install apparmor profile to allow Electron sandbox to work
# This disables user namespace restrictions
os=$(grep -oP '^ID=\K.+' /etc/os-release | tr -d '"')
version=$(grep -oP '^VERSION_ID=\K.+' /etc/os-release | tr -d '"')

if [[ "$os" == "ubuntu" ]] && version_is_ge "$version" "24.04"; then
    echo "Creating apparmor profile"
    cp /opt/Mullvad\ VPN/resources/apparmor_mullvad /etc/apparmor.d/mullvad
    apparmor_parser -r /etc/apparmor.d/mullvad || echo "Failed to reload apparmor profile"
fi