a timeout.
/lib/dracut/hooks/pre-pivot/*.sh
+ scripts to run before latter initramfs cleanups
+
+/lib/dracut/hooks/pre-pivot-cleanup/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot "
hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
- hookdirs+="pre-mount pre-pivot mount "
+ hookdirs+="pre-mount pre-pivot pre-pivot-cleanup mount "
hookdirs+="emergency shutdown-emergency shutdown cleanup "
export hookdirs
}
=== Hook: pre-pivot
+This hook is called before pre-pivot-cleanup hook, This is a good place for
+actions other than cleanups which need to be called before pivot.
+
+
+=== Hook: pre-pivot-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
needed anymore.
-
=== Cleanup and switch_root
Init kills all udev processes, cleans up the environment, sets up the arguments
**rd.break**::
drop to a shell at the end
-**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot}_::
+**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|pre-pivot-cleanup}_::
drop to a shell on defined breakpoint
**rd.udev.info**::
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
-# pre pivot scripts are sourced just before we switch over to the new root.
+# pre pivot scripts are sourced just before we doing cleanup and switch over
+# to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break 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
+
# By the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do