summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2025-10-01 14:45:41 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2025-10-01 17:36:38 +0200
commitca71138acecf4a7ca22ed4366a0c2753051f34ae (patch)
tree02063f045e1ad538a8f1327f3fd02c699ad671f9
parent411165eaa0a8f278797f68ef9063ff3ccfd17385 (diff)
downloadmullvadvpn-ca71138acecf4a7ca22ed4366a0c2753051f34ae.tar.xz
mullvadvpn-ca71138acecf4a7ca22ed4366a0c2753051f34ae.zip
Install AppArmor profile if AppArmor is available
-rw-r--r--dist-assets/linux/after-install.sh17
1 files changed, 7 insertions, 10 deletions
diff --git a/dist-assets/linux/after-install.sh b/dist-assets/linux/after-install.sh
index 7701202b46..280c215a7d 100644
--- a/dist-assets/linux/after-install.sh
+++ b/dist-assets/linux/after-install.sh
@@ -7,18 +7,15 @@ 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
+# Check if the system supports a new-enough AppArmor version.
+function supported_apparmor() {
+ [[ -e /etc/apparmor.d/abi/4.0 ]]
}
-# 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
+if supported_apparmor; then
+ # Install our AppArmor profile and try to reload AppArmor.
+ # The AppArmor profile allow Electron sandbox to work.
+ # This disables user namespace restrictions.
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"