Adding a function to test wether the base html directory exists or not to test for acl and quota
This commit is contained in:
parent
ca5fbbf501
commit
3377553014
|
@ -63,6 +63,24 @@ check_mysql(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# default values for local.sh
|
# default values for local.sh
|
||||||
MYSQL_HOST=127.0.0.1
|
MYSQL_HOST=127.0.0.1
|
||||||
MYSQL_DATABASE=alternc
|
MYSQL_DATABASE=alternc
|
||||||
|
@ -192,10 +210,12 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
|
|
||||||
ALTERNC_HTML="$RET"
|
ALTERNC_HTML="$RET"
|
||||||
#checking acl and quota activation.
|
#checking acl and quota activation.
|
||||||
MOUNT_POINT=$(df -P ${ALTERNC_HTML%/*} | tail -n 1 | awk '{print $6}')
|
basedir=`get_first_existing_dir "$ALTERNC_HTML"`;
|
||||||
aclcheckfile="$ALTERNC_HTML/test-acl"
|
MOUNT_POINT=$(df -P ${basedir%/*} | tail -n 1 | awk '{print $6}')
|
||||||
|
#we get the first existing dir
|
||||||
|
aclcheckfile="$basedir/test-acl"
|
||||||
touch "$aclcheckfile"
|
touch "$aclcheckfile"
|
||||||
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || ( echo "Error : ACL aren't activated on $ALTERNC_HTML AlternC can't work without it." ; exit 2)
|
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || ( echo "Error : ACL aren't activated on $basedir AlternC can't work without it." ; exit 2)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
db_input critical alternc/acluninstalled || true
|
db_input critical alternc/acluninstalled || true
|
||||||
|
@ -205,7 +225,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
quota_activation=$(quota -gA -f $MOUNT_POINT >/dev/null)
|
quota_activation=`$(quota -gA -f $MOUNT_POINT >/dev/null)`
|
||||||
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
Loading…
Reference in New Issue