fixed NFS mounting

master
Harald Hoyer 2009-05-20 14:04:33 +02:00
parent 3274a8f98e
commit ea62f0eb2a
3 changed files with 41 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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