forked from voc/voctomix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-ep.sh
executable file
·99 lines (88 loc) · 1.78 KB
/
docker-ep.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
##
## entrypoint for the docker images
if [ ! -f /.dockerenv ] && [ ! -f /.dockerinit ]; then
echo "WARNING: this script should be only run 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
fi
fi
function startCore() {
echo "Starting Voctomix CORE"
if [ -x /bin/gosu ]; then
gosu voc /opt/voctomix/voctocore/voctocore.py -v
else
echo "no gosu found..."
exec su -l -c "/opt/voctomix/voctocore/voctocore.py -v" voc
fi
}
function isVideoMounted() {
return grep -q '/video' /proc/mounts
}
function startGui() {
echo "Starting Voctomix GUI..."
if [ -x /bin/gosu ]; then
gosu voc /opt/voctomix/voctogui/voctogui.py -v
else
echo "no gosu found..."
exec su -l -c "/opt/voctomix/voctogui/voctogui.py -v" voc
fi
}
function listExamples() {
cd example-scripts/
find -type f
}
function runExample() {
if [ -z $1 ]; then
echo "no valid example! "
fi
FILENAME="example-scripts/$1"
if [ -f ${FILENAME} ]; then
echo "Running: ${FILENAME}"
${FILENAME}
fi
}
function usage() {
echo "Usage: $0 <cmd>"
echo "help - this text"
echo "core - starts voctomix gore"
echo "gui - starts the voctomix GUI"
echo "examples - lists the example scripts"
echo "bash - run interactive bash"
echo "scriptname.py - starts the example script named 'scriptname.py' "
}
if [ -z $1 ]; then
usage
exit
fi
case $1 in
help )
usage
;;
examples )
listExamples
;;
gui )
startGui
;;
core )
startCore
;;
bash )
shift
bash $@
;;
* )
runExample $1
;;
esac