Skip to content

Commit e1ea62b

Browse files
authored
fix: after-install.tpl - Detect if apparmor is enabled instead of just file-exists check (#8932)
1 parent 70d7c85 commit e1ea62b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/wise-apples-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: `after-install.tpl`: Detect if apparmor is enabled instead of just file-exists check

packages/app-builder-lib/templates/linux/after-install.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ fi
3636
#
3737
# Unfortunately, at the moment AppArmor doesn't have a good story for backwards compatibility.
3838
# https://askubuntu.com/questions/1517272/writing-a-backwards-compatible-apparmor-profile
39-
APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile'
40-
APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}'
41-
if test -d "/etc/apparmor.d"; then
39+
if apparmor_status --enabled > /dev/null 2>&1; then
40+
APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile'
41+
APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}'
4242
if apparmor_parser --skip-kernel-load --debug "$APPARMOR_PROFILE_SOURCE" > /dev/null 2>&1; then
4343
cp -f "$APPARMOR_PROFILE_SOURCE" "$APPARMOR_PROFILE_TARGET"
4444

@@ -54,4 +54,4 @@ if test -d "/etc/apparmor.d"; then
5454
else
5555
echo "Skipping the installation of the AppArmor profile as this version of AppArmor does not seem to support the bundled profile"
5656
fi
57-
fi
57+
fi

0 commit comments

Comments
 (0)