diff options
author | Dave Reisner <dreisner@archlinux.org> | 2011-11-15 15:25:20 +0100 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-01-05 21:14:25 +0100 |
commit | 03deaed9f3f5b0c0537eb65e8f1862f53bc21fec (patch) | |
tree | a7ae64df327b4f1351ede76d0efd6e9a9bdf7053 /shutdown | |
parent | bd4f7d6ee8f8527625b9f240a7e5b68b2d1f87bb (diff) | |
download | mkinitcpio-03deaed9f3f5b0c0537eb65e8f1862f53bc21fec.tar.gz mkinitcpio-03deaed9f3f5b0c0537eb65e8f1862f53bc21fec.tar.xz |
shutdown: add new hook0.8.1
This adds functionality to pivot to back to the initramfs on shutdown,
thereby allowing the system to unmount the real root device. This will
be necessary for anyone with /usr as a separate partition.
Diffstat (limited to 'shutdown')
-rwxr-xr-x | shutdown | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/shutdown b/shutdown new file mode 100755 index 0000000..100f505 --- /dev/null +++ b/shutdown @@ -0,0 +1,29 @@ +#!/usr/bin/ash + +findmnt -Rruno TARGET /oldroot | awk ' +BEGIN { i = 0 } +! /^\/(proc|dev|sys)/ { + i++ + mounts[i] = $0 +} +END { + for (j = i; j > 0; j--) { + print mounts[j] + } +} +' | while read -r mount; do + umount -l "$mount" +done + +case $1 in + reboot) + type kexec >/dev/null && kexec -e + reboot -f + ;; + poweroff|shutdown|halt) + "$1" -f + ;; + *) + poweroff -f + ;; +esac |