You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livecd-rootfs/live-build/ubuntu-touch/hooks/90-precompile-apparmor-poli...

29 lines
1.1 KiB

#!/bin/sh
FEATURES=/var/cache/apparmor/.features
echo "I: precompiling click apparmor policies"
/sbin/apparmor_parser -M ${FEATURES} -Q --write-cache --cache-loc=/var/cache/apparmor/ `find /var/lib/apparmor/profiles/ -maxdepth 1 -type f -not -path '*/\.*'`
echo "I: precompiling deb apparmor policies"
/sbin/apparmor_parser -M ${FEATURES} -Q --write-cache --cache-loc=/etc/apparmor.d/cache/ `find /etc/apparmor.d/ -maxdepth 1 -type f -not -path '*/\.*'`
echo "I: precompiling custom click apparmor policies"
mkdir -p /custom/cache/apparmor
/sbin/apparmor_parser -M ${FEATURES} -Q --write-cache --cache-loc=/custom/cache/apparmor/ `find /var/lib/apparmor/profiles/ -maxdepth 1 -type f -not -path '*/\.*'`
#get the apparmor manifests and profiles
mkdir -p /custom/lib/apparmor/clicks
mkdir -p /custom/lib/apparmor/profiles
for manifest in /var/lib/apparmor/clicks/*; do
case $(readlink -f $manifest) in
/custom/*)
mv $manifest /custom/lib/apparmor/clicks/$(basename $manifest)
profile=$(basename $manifest .json)
mv /var/lib/apparmor/profiles/click_$profile /custom/lib/apparmor/profiles
;;
esac
done