UNCLASSIFIED

You need to sign in or sign up before continuing.
Commit 90a119f2 authored by WingKwan Lau's avatar WingKwan Lau
Browse files

Update scripts/fix-permissions.sh

parent d67b6e8f
Pipeline #379533 canceled with stages
in 34 seconds
#!/bin/sh
# allow script to fail without failing build
set +e
# unless otherwise specified, follow symlinks
SYMLINK_OPT=${2:--L}
# catch error if file/directory does not exist
if ! [ -e "$1" ]; then
echo "ERROR: File or directory $1 does not exist." >&2
exit 0
fi
# fix group ownership
find $SYMLINK_OPT "$1" \! -gid 0 -exec chgrp 0 {} +
# fix group permissions
find $SYMLINK_OPT "$1" \! -perm -g+rw -exec chmod g+rw {} +
# ensure the group can execute any file executable by the owning user
find $SYMLINK_OPT "$1" -perm /u+x -a \! -perm /g+x -exec chmod g+x {} +
# ensure directories have executable permissions
find $SYMLINK_OPT "$1" -type d \! -perm /g+x -exec chmod g+x {} +
# always end successfully so that build does not fail
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment