I am building a server install script and want to to check if ACL support has been enabled before setting directory default permissions.
The getfacl
manpage states:
If getfacl is used on a file system that does not support ACLs, getfacl displays the access permissions defined by the traditional file mode permission bits.
I would rather not hack together a umask comparison, etc., but haven't discovered a better option anywhere.
Thoughts?
EDIT: I should include this is being attempted on CentOS 6.4 systems
Try this:
DIRECTORY="/home"
MOUNTPOINT=`df "$DIRECTORY" | tail -1 | awk '{ print $1 }'`
MOUNTSET=`/sbin/tune2fs -l $MOUNTPOINT | grep "Default mount options" | grep acl | wc -l`
if [ "$MOUNTSET" = "0" ]; then
echo "Mount point $MOUNTPOINT does not have enabled ACL."
else
echo "Juppi. Mount point $MOUNTPOINT have enabled ACL."
fi
Works fine on Debian 7.