-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·70 lines (50 loc) · 1.88 KB
/
entrypoint.sh
File metadata and controls
executable file
·70 lines (50 loc) · 1.88 KB
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
#!/bin/bash
export IFS=$'\n'
cat <<EOF
################################################################################
Welcome to the desktopcontainers/base-debian
################################################################################
EOF
INITALIZED="/.initialized"
if [ ! -f "$INITALIZED" ]; then
echo ">> CONTAINER: starting initialisation"
echo ">> CONTAINER: added environment vars to /etc/environment"
env >> /etc/environment
cp /container/config/openbox/menu.xml /etc/xdg/openbox/menu.xml
[ -z ${SERVER_NAME+x} ] && SERVER_NAME="localhost"
if [ ! -f "/certs/$SERVER_NAME.key" ] && [ ! -f "/certs/$SERVER_NAME.crt" ]; then
echo ">> CONTAINER: generating server tls certs (/certs/$SERVER_NAME.[key|crt])"
openssl req -x509 -newkey rsa:4096 \
-days 3650 \
-subj "/C=XX/ST=XXXX/L=XXXX/O=XXXX/CN=$SERVER_NAME" \
-keyout "/certs/$SERVER_NAME.key" \
-out "/certs/$SERVER_NAME.crt" \
-nodes -sha256
fi
echo ">> CONTAINER: openssh sshd config"
[ ! -f "/certs/ssh_host_rsa_key" ] && ssh-keygen -f /certs/ssh_host_rsa_key -N '' -t rsa -b 4096
cp /certs/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key
cp /container/config/ssh/sshd_config /etc/ssh/sshd_config
if [ "$ENABLE_SUDO" = "enable" ];
then
echo ">> CONTAINER: enable sudo for user app"
echo 'app ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/app
else
echo ">> CONTAINER: remove sudo from container"
apk del sudo >/dev/null 2>/dev/null
fi
[ "$ENABLE_KIOSK" = "enable" ] && echo ">> CONTAINER: enable Kiosk-Mode" && echo -e '#!/bin/sh\nexport DISPLAY=:0\nexec /usr/local/bin/app' > /container/config/runit/openbox/run
# INIT PHASE
touch "$INITALIZED"
else
echo ">> CONTAINER: already initialized - direct start of samba"
fi
# update app
cp /container/scripts/app /usr/local/bin/app
# PRE-RUN PHASE
##
# CMD
##
echo ">> CMD: exec docker CMD"
echo "$@"
exec "$@"