]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fixed NFS mounting
authorHarald Hoyer <harald@redhat.com>
Wed, 20 May 2009 12:04:33 +0000 (14:04 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 20 May 2009 12:25:31 +0000 (14:25 +0200)
modules.d/95NFS/install
modules.d/95NFS/nfs-mount-root.sh [deleted file]
modules.d/95NFS/nfs-parse-root-opts.sh [new file with mode: 0755]

index 4ddabaa6b53836ede98a531092d13401329b99a0..effdf2f71f3d8c42a0884baa39faf651f600d9ef 100755 (executable)
@@ -1,3 +1,4 @@
 #!/bin/sh
 inst mount.nfs
-inst_hook mount 96 "$moddir/nfs-mount-root.sh"
+inst_hook pre-mount 99 "$moddir/nfs-parse-root-opts.sh"
+instmods nfs
diff --git a/modules.d/95NFS/nfs-mount-root.sh b/modules.d/95NFS/nfs-mount-root.sh
deleted file mode 100755 (executable)
index 8f1e44e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-if [ "$root" = "dhcp" ]; then 
-    for dev in /net.*.dhcpopts; do 
-       if [ -f "$dev" ]; then 
-           . "$dev"
-           [ -n "$new_root_path" ] && nfsroot="$new_root_path"
-           if [ ! -s /.resume -a "$nfsroot" ]; then
-               if [ "${nfsroot#nfs://}" != "$nfsroot" ]; then
-                   nfsroot="${nfsroot#nfs://}"
-                   nfsroot="${nfsroot/\//:/}"
-               fi
-           fi
-       fi
-    done
-fi
-
-if [ "${root#/dev/}" = "$root" -a "${root/:\///}" != "$root" ]; then
-    nfsroot="$root"
-fi
-
-
-if [ -n "$nfsroot" ]; then
-    #
-    # modprobe nfs 
-    #
-    # start rpc.statd ??
-    mount -t nfs "$nfsroot" -o nolock "$NEWROOT" && ROOTFS_MOUNTED=yes
-fi
diff --git a/modules.d/95NFS/nfs-parse-root-opts.sh b/modules.d/95NFS/nfs-parse-root-opts.sh
new file mode 100755 (executable)
index 0000000..06228a8
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# exit if rootfstype is set and not nfs
+if [ -z "$fstype" -o "$fstype" = "nfs" ]; then
+    if [ "$root" = "dhcp" ]; then 
+       for dev in /net.*.dhcpopts; do 
+           if [ -f "$dev" ]; then 
+               . "$dev"
+               [ -n "$new_root_path" ] && nfsroot="$new_root_path"
+               if [ ! -s /.resume -a -n "$nfsroot" ]; then
+                   if [ "${nfsroot#nfs://}" != "$nfsroot" ]; then
+                       nfsroot="${nfsroot#nfs://}"
+                       nfsroot="${nfsroot/\//:/}"
+                   fi
+                   break
+               fi
+           fi
+       done
+    elif [ "${root#/dev/}" = "$root" -a "${root#*:/}" != "$root" ]; then
+       nfsroot="$root"
+    fi
+
+    # let user force override nfsroot
+    nfsroot_cmdl=$(getarg 'nfsroot=') 
+    [ -n "$nfsroot_cmdl" ] && nfsroot="$nfsroot_cmdl"
+
+    if [ -n "$nfsroot" ]; then
+       root="$nfsroot" 
+       fstype="-t nfs"
+       
+       if rflags="$(getarg rootflags=)"; then
+           getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
+       else
+           getarg rw && rflags=rw || rflags=ro
+       fi
+
+       rflags="nolock,$rflags"
+    fi
+fi