summaryrefslogtreecommitdiff
path: root/docker-ep.sh
diff options
context:
space:
mode:
authorbjoern <bjoern.riemer@web.de>2016-02-17 17:29:42 +0100
committerbjoern <bjoern.riemer@web.de>2016-02-17 17:31:16 +0100
commitd2d5e14aa309d4167aba14504e01ec8d3157c0a8 (patch)
treeca29a0d9aed4ff7d3cad53e22156c1f6e23936f1 /docker-ep.sh
parent1070a11b1452aa6cf89b29eee43c1d7d661ddf6f (diff)
check if the entrypint script is run in a docker
Diffstat (limited to 'docker-ep.sh')
-rwxr-xr-xdocker-ep.sh32
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