From c347befe9b7b0e78edc87b40f4e85ec0ab558240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Tue, 17 Sep 2024 19:59:22 +0200 Subject: [PATCH] fix: :bug: setpermission.sh now uses setfacl properly. --- .metadata | Bin 9276 -> 9276 bytes setpermissions.sh | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.metadata b/.metadata index a3cad5f682ddf86417eaee9a43d5157bc9f4a8be..13b143c239e7a5e21b5c07c2eaeea27e43723757 100644 GIT binary patch delta 74 zcmdnvvBzTr7povw{^>LZAo$w%ofAZFm@K0px!HtuI}eZl!IxmEjWa(9P7ail-Yg^( Z%*yg0@kQF?gB&80?U*<=w~BA)0RVj67(oC4 delta 74 zcmdnvvBzTr7pq`&_USYRAn*-7CIzB5OqNlQ+-$/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! :)