fix: 🐛 setpermission.sh now uses setfacl properly.
This commit is contained in:
parent
145aab5386
commit
2334f7c46d
@ -59,14 +59,8 @@ if [ -n "$(which awk)" -a -n "$(which cut)" -a -n "$(which find)" -a -n "$(which
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restoring the permissions.
|
# We'll use the metastore DB (if any) to restore
|
||||||
#
|
# the dates and saved permissions individually.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
if [ -n "$(which metastore)" -a -x "$(which metastore)" ]; then
|
if [ -n "$(which metastore)" -a -x "$(which metastore)" ]; then
|
||||||
( cd "$SCRPATH"
|
( cd "$SCRPATH"
|
||||||
@ -75,5 +69,17 @@ if [ -n "$(which metastore)" -a -x "$(which metastore)" ]; then
|
|||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
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! :)
|
# That's all, Folks! :)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user