From d4244cb25bb9fd72854ae8da313a5a40ce02aec4 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 18 May 2009 19:55:58 +0200 Subject: [PATCH] support normal nfs root definition syntax --- modules.d/95NFS/nfs-mount-root.sh | 40 +++++++++++++++++++++++---------------- test/make-server-root | 2 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/modules.d/95NFS/nfs-mount-root.sh b/modules.d/95NFS/nfs-mount-root.sh index a0ffd39..a041207 100755 --- a/modules.d/95NFS/nfs-mount-root.sh +++ b/modules.d/95NFS/nfs-mount-root.sh @@ -1,21 +1,29 @@ #!/bin/sh set -x - -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/\//:/}" - # - #modprobe nfs - # - # start rpc.statd ?? - mount -t nfs "$nfsroot" -o nolock "$NEWROOT" && ROOTFS_MOUNTED=yes +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 - fi -done + 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/test/make-server-root b/test/make-server-root index e4fdda7..22ab83a 100755 --- a/test/make-server-root +++ b/test/make-server-root @@ -30,7 +30,7 @@ EOF expand-hosts domain=test.net dhcp-range=192.168.1.100,192.168.1.150,168h -dhcp-option=17,"nfs://192.168.1.1/mnt/root" +dhcp-option=17,"192.168.1.1:/mnt/root" EOF ) inst /etc/nsswitch.conf /etc/nsswitch.conf -- 2.7.4