diff options
-rwxr-xr-x | docker-ep.sh | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/docker-ep.sh b/docker-ep.sh index aa8e8a2..3e2b630 100755 --- a/docker-ep.sh +++ b/docker-ep.sh @@ -2,16 +2,23 @@ ## ## entrypoint for the docker images -groupmod -g $gid voc -usermod -u $uid -g $gid voc +if [ ! -f /.dockerenv ] && [ ! -f /.dockerinit ]; then + echo "WARNING: this scrip should be only runed inside docker!!" + exit 1 +fi + +if [ ! -z $gid ] && [ ! -z $uid ]; then + groupmod -g $gid voc + usermod -u $uid -g $gid voc -# check if homedir is mounted -if grep -q '/home/voc' /proc/mounts; then - # homedir is mounted into the docker so don't touch the ownership of the files - true -else - # fixup for changed uid and gid - chown -R voc:voc /home/voc + # check if homedir is mounted + if grep -q '/home/voc' /proc/mounts; then + # homedir is mounted into the docker so don't touch the ownership of the files + true + else + # fixup for changed uid and gid + chown -R voc:voc /home/voc + fi fi function startCore() { @@ -62,6 +69,11 @@ function usage() { echo "scriptname.py - starts the example script named 'scriptname.py' " } +if [ -z $1 ]; then + usage + exit +fi + case $1 in help ) usage @@ -82,4 +94,4 @@ case $1 in * ) runExample $1 ;; -esac
\ No newline at end of file +esac |