dracut.sh: turn off host-only mode, if essential system filesystems not mounted
authorHarald Hoyer <harald@redhat.com>
Wed, 20 Mar 2013 09:22:41 +0000 (10:22 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 20 Mar 2013 09:22:41 +0000 (10:22 +0100)
dracut.sh

index 7728712..9afa694 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -781,6 +781,15 @@ fi
 # Need to be able to have non-root users read stuff (rpcbind etc)
 chmod 755 "$initdir"
 
+if [[ $hostonly ]]; then
+    for i in /sys /proc /run /dev; do
+        if ! findmnt "$i" &>/dev/null; then
+            dwarning "Turning off host-only mode: '$i' is not mounted!"
+            unset hostonly
+        fi
+    done
+fi
+
 declare -A host_fs_types
 
 for line in "${fstab_lines[@]}"; do