diff options
author | Tom Gundersen <teg@jklm.no> | 2011-08-23 19:45:16 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-08-25 18:54:12 +0200 |
commit | 8271087636e09ff40c10a8911250fd37af467bc0 (patch) | |
tree | a94f5ef1f7aacf122400d670b94f4945c79a18b7 /rc.shutdown | |
parent | abd2fa8211a58761782c0b396f8e9c9d8a516abc (diff) |
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 <teg@jklm.no>
Diffstat (limited to 'rc.shutdown')
-rwxr-xr-x | rc.shutdown | 13 |
1 files changed, 12 insertions, 1 deletions
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 >/dev/console 2>&1 + exec chroot . /shutdown $action </dev/console >/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 |