summaryrefslogtreecommitdiff
path: root/old-school/init.shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'old-school/init.shutdown')
-rwxr-xr-xold-school/init.shutdown30
1 files changed, 30 insertions, 0 deletions
diff --git a/old-school/init.shutdown b/old-school/init.shutdown
new file mode 100755
index 0000000..6bfce84
--- /dev/null
+++ b/old-school/init.shutdown
@@ -0,0 +1,30 @@
1#!/bin/sh
2read omitpids < /run/sendsigs.omit.d/samizdat
3for pid in $omitpids; do
4 if [ -e /proc/$pid/root ]; then
5 initroot=/proc/$pid/root
6 break
7 fi
8done
9
10warn() { echo "$*" >/dev/console; }
11error() { umount /sbin/init; exec /sbin/init; }
12
13[ -e "$initroot" ] || error
14
15if [ $$ != 1 ]; then
16 exec $initroot/init "$@"
17else
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
30fi