[arch-projects] [PATCH initscripts] add shutdown_preumount hook

Devin J. Pohly djpohly+arch at gmail.com
Tue Aug 30 12:45:22 EDT 2011

From: "Devin J. Pohly" <djpohly+arch at gmail.com>

This would be useful for filesystem monitoring software which needs to
capture all changes to the filesystem - including the final writes to
the random seed and wtmp.

Signed-off-by: Devin J. Pohly <djpohly+arch at gmail.com>
 functions   |    1 +
 rc.shutdown |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/functions b/functions
index f68c088..e9c7711 100644
--- a/functions
+++ b/functions
@@ -469,6 +469,7 @@ bootlogd_stop() {
 # single_prekillall: before all processes are being killed in rc.single
 # shutdown_postkillall: after all processes have been killed in rc.shutdown
 # single_postkillall: after all processes have been killed in rc.single
+# shutdown_preumount: after last filesystem write, but before filesystems are unmounted
 # shutdown_postumount: after filesystems are unmounted
 # shutdown_poweroff: directly before powering off in rc.shutdown
diff --git a/rc.shutdown b/rc.shutdown
index db8f50b..909fe06 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -51,6 +51,8 @@ status "Deactivating Swap" swapoff -a
 	status "Deactivating monitoring of LVM2 groups" \
 		vgchange --monitor n &>/dev/null
+run_hook shutdown_preumount
 # if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
 status "Unmounting Filesystems" \
 	umount -a -r -t nodevtmpfs,notmpfs,nosysfs,noproc,nodevpts -O no_netdev

More information about the arch-projects mailing list