File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
: " ${PROJECT_DIR:=/ project} "
4
4
: " ${GITMAN_CACHE:=/ tmp} "
5
+ : " ${FIX_PERMISSIONS:= 1} "
5
6
6
7
isCommand () {
7
8
case " $1 " in
@@ -26,8 +27,6 @@ if [ -n "$PROJECT_DIR" ] && [ -d "$PROJECT_DIR" ] && [ -w "$PROJECT_DIR" ]; then
26
27
fi
27
28
fi
28
29
29
- set -x
30
-
31
30
# check if the first argument passed in looks like a flag
32
31
if [ " $( printf %c " $1 " ) " = ' -' ]; then
33
32
set -- gitman " $@ "
43
42
exit 1
44
43
fi
45
44
46
- exec " $@ "
45
+ if [ " $( id -u) " = 0 ] && [ " $FIX_PERMISSIONS " = 1 ]; then
46
+ command " $@ "
47
+ if [ -f " ${PROJECT_DIR} /gitman.yml" ] &&
48
+ location=" $( grep ^location: " ${PROJECT_DIR} /gitman.yml" | cut -c11-) " &&
49
+ [ -w " ${PROJECT_DIR} /${location} " ];
50
+ then
51
+ chown --recursive --reference=" $PROJECT_DIR " " ${PROJECT_DIR} /${location} "
52
+ fi
53
+ else
54
+ exec " $@ "
55
+ fi
You can’t perform that action at this time.
0 commit comments