docker-init
787 Bytes
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
#!/bin/bash
set -e
onexit() {
export PREVLEVEL=$RUNLEVEL RUNLEVEL=1
/etc/init.d/rc 1
# Turn services back off
echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d
rm -f /etc/init.d/.legacy-bootordering
}
trap onexit EXIT
rm -f /usr/sbin/policy-rc.d
if [[ -e /etc/docker-init/runtime/settings.sh ]]; then
. /etc/docker-init/runtime/settings.sh
fi
if [[ $UID && $GID ]]; then
addgroup --gid $GID hostuser
adduser --disabled-password --uid $UID --gid $GID --gecos "" hostuser
fi
for pre_config_service in /etc/docker-init/runtime/pre-config/*.sh; do
[[ -r $pre_config_service ]] || continue
(
. "$pre_config_service"
)
done
touch /etc/init.d/.legacy-bootordering
export RUNLEVEL=2 PREVLEVEL=
/etc/init.d/rc 2
if [[ $# -gt 0 ]]; then
"$@"
else
tail -f /var/log/syslog
fi