summaryrefslogtreecommitdiff
path: root/old-school/init.shutdown
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-04-19 14:39:53 -0400
committerAndrew Cady <d@jerkface.net>2016-04-19 14:39:53 -0400
commite98c4babea202d692a5dac8c05efc64a44e8aedc (patch)
tree033df22923a6b09b3395006ed4e2056afc281ff9 /old-school/init.shutdown
parent3884276c13d142483b1a018b31f5723e3961965f (diff)
cause the grok-block hooks to run
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