From 8271087636e09ff40c10a8911250fd37af467bc0 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 23 Aug 2011 19:45:16 +0200 Subject: sutdown: support both poweroff and reboot Tell the /run/initramfs/shutdown what action to preform. Still no kexec support though. Signed-off-by: Tom Gundersen --- rc.shutdown | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'rc.shutdown') diff --git a/rc.shutdown b/rc.shutdown index d11aeee..22f6bcc 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -79,6 +79,14 @@ fi status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null if [[ -x /run/initramfs/shutdown ]]; then + + # decide what we want to do + if [[ $RUNLEVEL = 0 ]]; then + action="poweroff" + else + action="reboot" + fi + # make /run/initrafs a mount mount --bind /run/initramfs /run/initramfs @@ -102,8 +110,10 @@ if [[ -x /run/initramfs/shutdown ]]; then /oldroot/sbin/init u # run /shutdown in the new root - exec chroot . /shutdown /dev/console 2>&1 + exec chroot . /shutdown $action /dev/console 2>&1 + else + status "Remounting Root Filesystem Read-only" \ mount -n -o remount,ro / @@ -120,6 +130,7 @@ else [[ -x $(type -P kexec) ]] && kexec -e &>/dev/null reboot -d -f -i fi + fi # End of file -- cgit v1.2.3