File tree 1 file changed +16
-6
lines changed
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 3
3
# Allow this script to fail without failing a build
4
4
set +e
5
5
6
- # Fix permissions on the given directory to allow group read/write of
6
+ # Fix permissions on the given directory or file to allow group read/write of
7
7
# regular files and execute of directories.
8
- chgrp -R 0 $1 ;
9
- find -L $1 -xtype l -exec chgrp 0 {} \;
10
- chmod -R g+rw $1 ;
11
- find -L $1 -xtype l -exec chmod g+rw {} \;
12
- find $1 -type d -exec chmod g+x {} +
8
+
9
+ # If argument does not exist, script will still exit with 0,
10
+ # but at least we'll see something went wrong in the log
11
+ if ! [ -e " $1 " ] ; then
12
+ echo " ERROR: File or directory $1 does not exist." >&2
13
+ # We still want to end successfully
14
+ exit 0
15
+ fi
16
+
17
+ find -L " $1 " \! -gid 0 -exec chgrp 0 {} +
18
+ find -L " $1 " \! -perm /g+rw -exec chmod g+rw {} +
19
+ find -L " $1 " -perm /u+x -a \! -perm /g+x -exec chmod g+x {} +
20
+ find -L " $1 " -type d \! -perm /g+x -exec chmod g+x {} +
21
+
22
+ # Always end successfully
13
23
exit 0
You can’t perform that action at this time.
0 commit comments