2
0

fix: 🐛 setpermission.sh now uses setfacl properly.

This commit is contained in:
Kovács Zoltán 2024-09-17 19:59:22 +02:00
parent 145aab5386
commit c347befe9b
2 changed files with 14 additions and 8 deletions

BIN
.metadata

Binary file not shown.

View File

@ -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! :)