File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- # Get UID/GID from volume dir
6
- VOLUME_UID=$( stat -c ' %u' $VOLUME_DIR )
7
- VOLUME_GID=$( stat -c ' %g' $VOLUME_DIR )
8
-
9
- MY_UID=$( id -u)
10
- MY_GID=$( id -g)
11
-
12
5
# Run as custom user
13
- if [ " $MY_GID " != " $VOLUME_GID " ] || [ " $MY_UID " != " $VOLUME_UID " ]; then
6
+ if ! [ -w $VOLUME_DIR ]; then
7
+ # Get UID/GID from volume dir
8
+ VOLUME_UID=$( stat -c ' %u' $VOLUME_DIR )
9
+ VOLUME_GID=$( stat -c ' %g' $VOLUME_DIR )
10
+
14
11
# create or modify user and group to match expected uid/gid
15
12
groupadd --gid $VOLUME_GID archivist || groupmod -o --gid $VOLUME_GID archivist
16
13
useradd -ms /bin/bash -u $VOLUME_UID -g $VOLUME_GID archivist || usermod -o -u $VOLUME_UID archivist
36
33
# run process directly
37
34
exec $@
38
35
fi
39
-
You can’t perform that action at this time.
0 commit comments