diff --git a/snapcraft/hooks/connect-plug-ceph-conf b/snapcraft/hooks/connect-plug-ceph-conf index df2b58b2c..edd8ab8cf 100755 --- a/snapcraft/hooks/connect-plug-ceph-conf +++ b/snapcraft/hooks/connect-plug-ceph-conf @@ -1,4 +1,10 @@ #!/bin/sh +set -eu + +# Re-exec outside of apparmor confinement +if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then + exec aa-exec -p unconfined -- "$0" "$@" +fi # Utility functions get_bool() { diff --git a/snapcraft/hooks/disconnect-plug-ceph-conf b/snapcraft/hooks/disconnect-plug-ceph-conf index b169f23d8..6df9ed9bf 100755 --- a/snapcraft/hooks/disconnect-plug-ceph-conf +++ b/snapcraft/hooks/disconnect-plug-ceph-conf @@ -1,4 +1,10 @@ #!/bin/sh +set -eu + +# Re-exec outside of apparmor confinement +if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then + exec aa-exec -p unconfined -- "$0" "$@" +fi # Utility functions get_bool() {