diff options
Diffstat (limited to 'src/initrd/init.shutdown')
-rwxr-xr-x | src/initrd/init.shutdown | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/initrd/init.shutdown b/src/initrd/init.shutdown new file mode 100755 index 0000000..6bfce84 --- /dev/null +++ b/src/initrd/init.shutdown | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/bin/sh | ||
2 | read omitpids < /run/sendsigs.omit.d/samizdat | ||
3 | for pid in $omitpids; do | ||
4 | if [ -e /proc/$pid/root ]; then | ||
5 | initroot=/proc/$pid/root | ||
6 | break | ||
7 | fi | ||
8 | done | ||
9 | |||
10 | warn() { echo "$*" >/dev/console; } | ||
11 | error() { umount /sbin/init; exec /sbin/init; } | ||
12 | |||
13 | [ -e "$initroot" ] || error | ||
14 | |||
15 | if [ $$ != 1 ]; then | ||
16 | exec $initroot/init "$@" | ||
17 | else | ||
18 | set -- | ||
19 | for pid in $omitpids; do | ||
20 | set -- "$@" -o $pid | ||
21 | done | ||
22 | if killall5 -15 "$@"; then | ||
23 | sleep 5 | ||
24 | killall5 -9 "$@" | ||
25 | fi | ||
26 | exec <$initroot/dev/console >$initroot/dev/console 2>$initroot/dev/console | ||
27 | exec chroot $initroot umountall.sh | ||
28 | |||
29 | error | ||
30 | fi | ||