-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdocker-start.sh
executable file
·49 lines (36 loc) · 1.15 KB
/
docker-start.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
#!/bin/bash
# Droppy docker start file
#
# .:.
# ::: .:::::. Droppy
# ..:::.. ::: Made with love <3
# ':::' :::
# '
#
# Determine a UID/GID otherwise default to 0
[ -z "${UID}" ] && UID=0
[ -z "${GID}" ] && GID=0
FILE="/droppy/UID-${UID}_GID-${GID}"
if [ ! -f "${FILE}" ]; then
# echo >> /etc/xxx and not adduser/addgroup because adduser/addgroup
# won't work if uid/gid already exists.
echo -e "droppy:x:${UID}:${GID}:droppy:/home/droppy:/bin/false" >> /etc/passwd
echo -e "droppy:x:${GID}:droppy" >> /etc/group
# create shadow files from /etc/passwd and /etc/group
grpconv
pwconv
# it's better to do that (mkdir and chown) here than in the Dockerfile
# because it will be executed even on volumes if mounted.
mkdir -p /config
mkdir -p /files
mkdir -p /home/droppy/.droppy
ln -s /config /home/droppy/.droppy/config
ln -s /files /home/droppy/.droppy/files
chown -R droppy:droppy /home/droppy
chown -R droppy:droppy /config
chown droppy:droppy /files
export HOME=/home/droppy
volta install node
touch "${FILE}"
fi
exec /bin/su droppy -s /bin/bash -c "node /droppy/packages/cli/lib/cli.js start"