Backporting new way of checking acl activation upon installation from alternc-3.1~alpha1

This commit is contained in:
Steven Mondji-Lerider 2013-03-04 10:54:37 +00:00
parent 7834f399ea
commit 93a280cce4
1 changed files with 33 additions and 11 deletions

44
debian/alternc.config vendored
View File

@ -27,6 +27,24 @@ function valid_ip()
}
function get_first_existing_dir() {
# Prend en premier parametre un chemin
# Retourne le répertoire parent existant le plus "proche"
# Exemple: on lui donne /var/www/alternc/gerard/dupont/ mais
# seul /var/www/alternc existe, ca répond /var/www/alternc
dir="$1"
if [ -z "$dir" ] ; then
return 0
fi
if ! test -d "$dir" ; then
get_first_existing_dir "$(dirname "$dir")"
else
echo "$dir"
fi
}
#checking mysql connectivity and updating local.sh variables accordingly
check_mysql(){
@ -183,24 +201,28 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 11 ]; do
db_get alternc/alternc_location
LOCATION="$RET"
#checking acl and quota activation, does't work with NFS yet. should now work with lxc
MOUNT_POINT=$(df -P ${LOCATION%/*} | tail -n 1 | awk '{print $6}')
#checking acl and quota activation.
basedir=`get_first_existing_dir "$LOCATION"`;
MOUNT_POINT=$(df -P ${basedir} | tail -n 1 | awk '{print $6}')
#we get the first existing dir
aclcheckfile="$basedir/test-acl"
touch "$aclcheckfile"
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null
# Get the mount options for the path: (warning, / may have multiple declarations, take the last one only :
MOUNT_OPTS=$(awk '$2=="'$MOUNT_POINT'" { print $4 }' /proc/mounts | tail -1)
# Check to see if acl is one of the mount points:
ACL="$(echo "$MOUNT_OPTS" | tr "," "\\n" | egrep '^acl|attr2|user_xattr$')" || true
if [ -z "$ACL" ]; then
if [ $? -ne 0 ]; then
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
db_input critical alternc/acluninstalled || true
db_go
db_reset alternc/acluninstalled || true
db_fset alternc/acluninstalled "seen" "false" || true
exit 2
fi
quota_activation=$(quotaon -pa 2>/dev/null |grep '^group.*on$' | /usr/bin/awk '$4 ~ /^\'$MOUNT_POINT'$/ {print $4}')
if [ -z "$quota_activation" -o "$quota_activation" != "$MOUNT_POINT" ]; then
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
quota -gA -f $MOUNT_POINT 2>/dev/null
if [ $? -ne 0 ]; then
db_get alternc/quotauninstalled
if [ -z "$RET" ]; then
db_input critical alternc/quotauninstalled || true