profile-load: use less ambiguous if/then construct

As shellcheck taught me
today (https://github.com/koalaman/shellcheck/wiki/SC2015),
"A && B || C is not if-then-else. C may run when A is true".

It does not matter here in practice, because worst case we would run "true" once
too many, but still.
This commit is contained in:
intrigeri 2022-02-15 07:31:31 +00:00
parent 35f23a6da1
commit 322b3f4d3e

View file

@ -24,7 +24,11 @@
. /lib/apparmor/rc.apparmor.functions
# do not load in a container
[ -x /usr/bin/systemd-detect-virt ] && systemd-detect-virt --quiet --container && ! is_container_with_internal_policy && exit 0 || true
if [ -x /usr/bin/systemd-detect-virt ] && \
systemd-detect-virt --quiet --container && \
! is_container_with_internal_policy; then
exit 0
fi
[ -d /rofs/etc/apparmor.d ] && exit 0 # do not load if running liveCD