From 8a81daeb4fdc9f559ef972ac5a2cda9f313000f1 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 16 Feb 2010 00:30:48 +0100 Subject: Introduce mount handlers Instead of having special NFS code in /init, make it possible for a hook to register a mount handler When a hook sets the mount_handler environment variable, the normal mount code will be skipped and the handler will be called with the path to mount point as the first and only argument. --- hooks/net | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hooks') diff --git a/hooks/net b/hooks/net index ff33955..d2085c7 100644 --- a/hooks/net +++ b/hooks/net @@ -80,6 +80,20 @@ run_hook () rootfstype="nfs" echo "NFS-Mount: ${nfs_server}:${nfs_path}" + + # set mount handler for NFS + mount_handler="nfs_mount_handler" fi fi } + +nfs_mount_handler() { + if [ -z "$nfs_server" -o -z "$nfs_path" ]; then + err "Unable to mount root filesystem over NFS: wrong parameters." + echo "You are being dropped to a recovery shell" + echo " Type 'exit' to try and continue booting" + launch_interactive_shell + msg "Trying to continue (this will most likely fail) ..." + fi + nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1" +} -- cgit v1.2.3-24-g4f1b