What if the test was changed to check writability of path_max? Just changing the the check for the sysfs path to -w won't work for root, but maybe something like this (perhaps there's a simpler way to do the check though):
if [[ -f /sys/module/apparmor/parameters/path_max &&
$(stat -c "%a" /sys/module/apparmor/parameters/path_max) == "600" ]] ; then buf_max=2048 #standard x86 page size/2 old_max=`cat /sys/module/apparmor/parameters/path_max`
echo $buf_max > /sys/module/apparmor/parameters/path_max
else
echo "WARNING: This version of AppArmor does not support changing buffer size."
fi
What if the test was changed to check writability of path_max? Just changing the the check for the sysfs path to -w won't work for root, but maybe something like this (perhaps there's a simpler way to do the check though):
if [[ -f /sys/module/ apparmor/ parameters/ path_max && apparmor/ parameters/ path_max) == "600" ]] ; then
buf_max= 2048 #standard x86 page size/2
old_max= `cat /sys/module/ apparmor/ parameters/ path_max` apparmor/ parameters/ path_max
$(stat -c "%a" /sys/module/
echo $buf_max > /sys/module/
else
echo "WARNING: This version of AppArmor does not support changing buffer size."
fi