diff --git a/.metadata b/.metadata index a3cad5f..13b143c 100644 Binary files a/.metadata and b/.metadata differ diff --git a/setpermissions.sh b/setpermissions.sh index 6872ea0..91a9c14 100644 --- a/setpermissions.sh +++ b/setpermissions.sh @@ -59,14 +59,8 @@ if [ -n "$(which awk)" -a -n "$(which cut)" -a -n "$(which find)" -a -n "$(which done fi -# Restoring the permissions. -# -# First a base setup - sets permissions to 770/660 [umask 007] -chmod -R g+rw,o-rw "$SCRPATH" -find "$SCRPATH" -type d -exec chmod 2771 {} \; -[[ -n "$(which setfacl)" ]] && setfacl -R -d -m u:$USER:rwX,g::rwX "$SCRPATH" 2>/dev/null -# -# Then we'll use the metastore DB to set the permissions individually. +# We'll use the metastore DB (if any) to restore +# the dates and saved permissions individually. # if [ -n "$(which metastore)" -a -x "$(which metastore)" ]; then ( cd "$SCRPATH" @@ -75,5 +69,17 @@ if [ -n "$(which metastore)" -a -x "$(which metastore)" ]; then fi ) fi +# +# Finally we correct the permissions according to umask 007, +# allow access to directories for backup purposes +# and we grant R/W permission to the user running the script. +chmod -R g+rw,o-rw "$SCRPATH" +find "$SCRPATH" -type d -exec chmod 2771 {} \; +SETFACL="$(which setfacl)" +if [ -n "$SETFACL" ]; then + "$SETFACL" -R -d -m u:$USER:rwX,g::rwX "$SCRPATH" 2>/dev/null + find "$SCRPATH" -type d -exec "$SETFACL" -m u:$USER:rwx {} 2>/dev/null \; + find "$SCRPATH" -type f -exec "$SETFACL" -m u:$USER:rw {} 2>/dev/null \; +fi # That's all, Folks! :)