]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Allow NFS and NBD to be built into the kernel
authorDavid Dillow <dave@thedillows.org>
Mon, 1 Jun 2009 23:59:22 +0000 (19:59 -0400)
committerDavid Dillow <dave@thedillows.org>
Mon, 1 Jun 2009 23:59:22 +0000 (19:59 -0400)
Probe for NFS and NBD capability before trying to load their modules
in case they are built into the kernel. Ugly use of flag files, but
avoids the need for grep to be on the image.

modules.d/95nbd/nbdroot
modules.d/95nfs/nfsroot

index 51120c2462fa267f04a0c56e07f56f14102985e9..1130cca0a13edee1d59d4b8c1f665d593c639e2d 100755 (executable)
@@ -71,7 +71,17 @@ getarg ro && nbdrw=ro
 getarg rw && nbdrw=rw
 fsopts=${fsopts+$fsopts,}${nbdrw}
 
-modprobe nbd || exit 1
+if [ ! -e /tmp/nbd.present ]; then
+    cat /proc/devices | while read t1 devt; do
+       if [ "$devt" = "nbd" ]; then
+           >/tmp/nfs.present
+           break
+       fi
+    done
+fi
+if [ ! -e /tmp/nbd.present ]; then
+    modprobe nbd || exit 1
+fi
 
 # XXX better way to wait for the device to be made?
 i=0
index 18e1300d93b3de2a88713586aaa752f4519ac5f1..2d08b68a0a508697a2c49febaaf53845a81e8747 100755 (executable)
@@ -46,7 +46,16 @@ getarg rw && nfsrw=rw
 nfsflags=${nfsflags+$nfsflags,}${nfsrw}
 
 # Load the modules so the filesystem type is there
-modprobe nfs || exit 1
+if [ ! -e /tmp/nfs.present ]; then
+    cat /proc/filesystems | while read t1 fst; do
+        case "$fst" in
+           nfs|nfs4) >/tmp/nfs.present; break ;;
+       esac
+    done
+fi
+if [ ! -e /tmp/nfs.present ]; then
+    modprobe nfs || exit 1
+fi
 
 # XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /