]>
Commit | Line | Data |
---|---|---|
7b25f331 WB |
1 | #!/usr/bin/bash |
2 | ||
3 | # no runlevels | |
4 | (($$ != 1)) && exit 0 | |
5 | ||
6 | msg() { | |
7 | local mesg="$1"; shift | |
8 | printf "${mesg}\n" "$@" | |
9 | } | |
10 | ||
11 | die() { | |
12 | local mesg="$1"; shift | |
13 | printf "error: ${mesg}\n" "$@" >&2 | |
14 | exit 1 | |
15 | } | |
16 | ||
17 | do_exit() { | |
18 | msg "stopping init"; | |
19 | exit 0 | |
20 | } | |
21 | ||
22 | # lxc sends 48 for some reason with --kill instead of stopsignal | |
23 | trap do_exit SIGINT SIGTERM SIGHUP SIGPWR 48 | |
24 | ||
25 | msg "starting bash init... $*" | |
26 | ||
27 | [[ -d "/proc/$$" ]] || mount -t proc proc /proc \ | |
28 | || die 'unable to mount /proc' | |
29 | ||
30 | hostname localhost || die 'unable to set hostname' | |
31 | ||
32 | sleep infinity & | |
33 | wait |