[arch-projects] [PATCH] [initscripts] Add hook shutdown_pivotroot
This can be useful for run apcupsd --killpower Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- functions | 1 + rc.shutdown | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/functions b/functions index ab6d9ae..34fd31b 100644 --- a/functions +++ b/functions @@ -501,6 +501,7 @@ bootlogd_stop() { # shutdown_postkillall: after all processes have been killed in rc.shutdown # single_postkillall: after all processes have been killed in rc.single # shutdown_postumount: after filesystems are unmounted +# shutdown_pivotroot: before pivot_root in rc.shutdown # shutdown_poweroff: directly before powering off in rc.shutdown # # Declare add_hook and run_hook as read-only to prevent overwriting them. diff --git a/rc.shutdown b/rc.shutdown index ea86f8f..1b35148 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -98,6 +98,8 @@ if [[ -x /run/initramfs/shutdown ]]; then mount --bind /dev /run/initramfs/dev mount --bind /run /run/initramfs/run + run_hook shutdown_pivotroot + # enter shutdownramfs cd /run/initramfs pivot_root . oldroot -- 1.7.6.4
Gerardo, On Mon, Sep 26, 2011 at 2:02 AM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
This can be useful for run apcupsd --killpower
Rather than adding a new hook, what about reusing the old poweroff hook? There should not really be a difference between the two. My proposed patch below:
This will make sure the same hook is run regardless of whether you pivot to the shutdown ramfs or not. This is in order to run apcupsd --killpower as pointed out by Gerardo. Signed-off-by: Tom Gundersen <teg@jklm.no> --- rc.shutdown | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rc.shutdown b/rc.shutdown index ea86f8f..38b22b0 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -75,6 +75,8 @@ fi [[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] && status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null +run_hook shutdown_poweroff + if [[ -x /run/initramfs/shutdown ]]; then # decide what we want to do @@ -113,8 +115,6 @@ else status "Remounting Root Filesystem Read-only" \ mount -n -o remount,ro / - run_hook shutdown_poweroff - # Power off or reboot printsep if [[ $RUNLEVEL = 0 ]]; then -- 1.7.6.4
On 09/26/2011 11:06 AM, Tom Gundersen wrote:
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
participants (2)
-
Gerardo Exequiel Pozzi
-
Tom Gundersen