diff --git a/.changeset/wise-apples-look.md b/.changeset/wise-apples-look.md new file mode 100644 index 00000000000..e6809d10dce --- /dev/null +++ b/.changeset/wise-apples-look.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +fix: `after-install.tpl`: Detect if apparmor is enabled instead of just file-exists check diff --git a/packages/app-builder-lib/templates/linux/after-install.tpl b/packages/app-builder-lib/templates/linux/after-install.tpl index a3e48256889..6cf860bd284 100644 --- a/packages/app-builder-lib/templates/linux/after-install.tpl +++ b/packages/app-builder-lib/templates/linux/after-install.tpl @@ -36,9 +36,9 @@ fi # # Unfortunately, at the moment AppArmor doesn't have a good story for backwards compatibility. # https://askubuntu.com/questions/1517272/writing-a-backwards-compatible-apparmor-profile -APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile' -APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}' -if test -d "/etc/apparmor.d"; then +if apparmor_status --enabled > /dev/null 2>&1; then + APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile' + APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}' if apparmor_parser --skip-kernel-load --debug "$APPARMOR_PROFILE_SOURCE" > /dev/null 2>&1; then cp -f "$APPARMOR_PROFILE_SOURCE" "$APPARMOR_PROFILE_TARGET" @@ -54,4 +54,4 @@ if test -d "/etc/apparmor.d"; then else echo "Skipping the installation of the AppArmor profile as this version of AppArmor does not seem to support the bundled profile" fi -fi \ No newline at end of file +fi