Blob Blame History Raw
From eef7649e712481aa3bd821d4b11c39541611b4fd Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 23 Apr 2012 11:31:32 +0200
Subject: [PATCH] merge "cleanup" and "pre-pivot-cleanup" hooks

---
 README.modules                        |    2 +-
 dracut-functions.sh                   |    4 ++--
 dracut.asc                            |    4 ++--
 dracut.cmdline.7.asc                  |    2 +-
 modules.d/40network/module-setup.sh   |    2 +-
 modules.d/90crypt/module-setup.sh     |    2 +-
 modules.d/90multipath/module-setup.sh |    2 +-
 modules.d/95iscsi/module-setup.sh     |    2 +-
 modules.d/95nfs/module-setup.sh       |    2 +-
 modules.d/99base/init.sh              |    5 ++---
 10 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/README.modules b/README.modules
index 188d011..64d533f 100644
--- a/README.modules
+++ b/README.modules
@@ -105,7 +105,7 @@ init has the following hook points to inject scripts:
 /lib/dracut/hooks/pre-pivot/*.sh
    scripts to run before latter initramfs cleanups
 
-/lib/dracut/hooks/pre-pivot-cleanup/*.sh
+/lib/dracut/hooks/cleanup/*.sh
    scripts to run before the real init is executed and the initramfs
    disappears
    All processes started before should be killed here.
diff --git a/dracut-functions.sh b/dracut-functions.sh
index ccf3ba6..ff4e16d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -36,8 +36,8 @@ fi
 [[ $hookdirs ]] || {
     hookdirs="cmdline pre-udev pre-trigger netroot "
     hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
-    hookdirs+="pre-mount pre-pivot pre-pivot-cleanup mount "
-    hookdirs+="emergency shutdown-emergency shutdown cleanup "
+    hookdirs+="pre-mount pre-pivot cleanup mount "
+    hookdirs+="emergency shutdown-emergency shutdown "
     export hookdirs
 }
 
diff --git a/dracut.asc b/dracut.asc
index 9621db2..a6e050d 100644
--- a/dracut.asc
+++ b/dracut.asc
@@ -854,11 +854,11 @@ This hook is mainly to mount the real root device.
 
 === Hook: pre-pivot
 
-This hook is called before pre-pivot-cleanup hook, This is a good place for
+This hook is called before cleanup hook, This is a good place for
 actions other than cleanups which need to be called before pivot.
 
 
-=== Hook: pre-pivot-cleanup
+=== Hook: cleanup
 
 This hook is the last hook and is called before init finally switches root to
 the real root device. This is a good place to clean up and kill processes not
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 76db651..61cd139 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -105,7 +105,7 @@ Debug
 **rd.break**::
     drop to a shell at the end
 
-**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|pre-pivot-cleanup}_::
+**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}_::
     drop to a shell on defined breakpoint
 
 **rd.udev.info**::
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index c2ad815..d49b594 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -86,7 +86,7 @@ install() {
     inst_hook cmdline 97 "$moddir/parse-bridge.sh"
     inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
     inst_hook cmdline 99 "$moddir/parse-ifname.sh"
-    inst_hook pre-pivot-cleanup 10 "$moddir/kill-dhclient.sh"
+    inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
 
     _arch=$(uname -m)
 
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 4a66516..5082434 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -48,7 +48,7 @@ install() {
     inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
     inst_hook cmdline 10 "$moddir/parse-keydev.sh"
     inst_hook cmdline 30 "$moddir/parse-crypt.sh"
-    inst_hook pre-pivot-cleanup 30 "$moddir/crypt-cleanup.sh"
+    inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
     inst_simple /etc/crypttab
     inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
 }
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index f044f33..2bc1b41 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -70,7 +70,7 @@ install() {
     inst_libdir_file "multipath/*"
 
     inst_hook pre-trigger 02 "$moddir/multipathd.sh"
-    inst_hook pre-pivot-cleanup   02 "$moddir/multipathd-stop.sh"
+    inst_hook cleanup   02 "$moddir/multipathd-stop.sh"
     inst_rules 40-multipath.rules
 }
 
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index a001a28..2f343ee 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -63,7 +63,7 @@ install() {
     inst hostname
     inst iscsi-iname
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
-    inst_hook pre-pivot-cleanup 90 "$moddir/cleanup-iscsi.sh"
+    inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
     inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
     inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
 }
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 3587bdd..1d62e95 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -58,7 +58,7 @@ install() {
 
     inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
     inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
-    inst_hook pre-pivot-cleanup 99 "$moddir/nfsroot-cleanup.sh"
+    inst_hook cleanup 99 "$moddir/nfsroot-cleanup.sh"
     inst "$moddir/nfsroot.sh" "/sbin/nfsroot"
     inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
     mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index aea739f..cba2e1a 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -230,8 +230,8 @@ getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot
 source_hook pre-pivot
 
 # pre pivot cleanup scripts are sourced just before we switch over to the new root.
-getarg 'rd.break=pre-pivot-cleanup' 'rdbreak=pre-pivot-cleanup' && emergency_shell -n pre-pivot-cleanup "Break pre-pivot-cleanup"
-source_hook pre-pivot-cleanup
+getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
+source_hook cleanup
 
 # By the time we get here, the root filesystem should be mounted.
 # Try to find init. 
@@ -332,7 +332,6 @@ wait_for_loginit
 getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
 info "Switching root"
 
-source_hook cleanup
 
 unset PS4