Amélioration des traitements possible de fixperms

* Ajout de l'argument -d sous_repertoire

Il n'est pas neccessaire d'utiliser -l ou -u
sous_repertoire est un chemin relatif de profondeur n

Les droits seront corrigés pour l'ensemble des sous repertoires repondant à la contrainte : /var/alternc/html/l/login/sous_repertoire
This commit is contained in:
Camille Lafitte 2011-12-31 16:00:30 +00:00
parent d57e7c2752
commit 3bf287e3d6
1 changed files with 6 additions and 2 deletions

View File

@ -31,11 +31,12 @@
#Default Query : fixperms for all account #Default Query : fixperms for all account
query="SELECT uid,login FROM membres" query="SELECT uid,login FROM membres"
sub_dir=""
#Two optionals argument #Two optionals argument
# -l string : a specific login to fix # -l string : a specific login to fix
# -u interger : a specifi uid to fix # -u interger : a specifi uid to fix
while getopts "l:u:" optname while getopts "l:u:d:" optname
do do
case "$optname" in case "$optname" in
"l") "l")
@ -44,6 +45,9 @@ while getopts "l:u:" optname
"u") "u")
query="SELECT uid,login FROM membres WHERE uid LIKE '$OPTARG'" query="SELECT uid,login FROM membres WHERE uid LIKE '$OPTARG'"
;; ;;
"d")
sub_dir="$OPTARG"
;;
"?") "?")
echo "Unknown option $OPTARG - stop processing" echo "Unknown option $OPTARG - stop processing"
exit exit
@ -85,7 +89,7 @@ doone() {
echo "Setting rights and ownership for user $LOGIN having gid $GID" echo "Setting rights and ownership for user $LOGIN having gid $GID"
fi fi
INITIALE=`echo $LOGIN |cut -c1` INITIALE=`echo $LOGIN |cut -c1`
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN" REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
# Set the file readable only for the AlternC User # Set the file readable only for the AlternC User
chown -R $GID:$GID "$REP" chown -R $GID:$GID "$REP"