if check_occurances "$new_root_path" ':' 0; then
root="$nfsver::$new_root_path:"
fi ;;
+ '') root="$nfsver:::" ;;
esac
fi
nfspath=${root%%:*}
flags=${root#*:}
+[ -z "$nfspath" ] && nfspath=/tftpboot/%s
+
+# Kernel replaces first %s with host name, and falls back to the ip address
+# if it isn't set. Only the first %s is substituted.
+#
+if [ "${nfspath#*%s}" != "$nfspath" ]; then
+ ip=$(ip -o -f inet addr show $netif)
+ ip=${ip%%/*}
+ ip=${ip##* }
+ read node < /proc/sys/kernel/hostname
+ [ "$node" = "(none)" ] && node=$ip
+ nfspath=${nfspath%%%s*}$node${nfspath#*%s}
+fi
+
# look through the flags and see if any are overridden by the command line
# Append a , so we know we terminate
flags=${flags},
/nfs 192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
/nfs/client 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
+/nfs/nfs3-5 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
+/nfs/ip/192.168.50.101 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
+/nfs/tftpboot/nfs4-5 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
ip addr add 192.168.50.2/24 dev eth0
ip addr add 192.168.50.3/24 dev eth0
ip link set eth0 up
+mount --bind /nfs/client /nfs/nfs3-5
+mount --bind /nfs/client /nfs/ip/192.168.50.101
+mount --bind /nfs/client /nfs/tftpboot/nfs4-5
modprobe sunrpc
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
rpcbind
client_test "NFSv3 root=nfs nfsroot=/nfs/client" 52:54:00:12:34:04 \
"root=nfs nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+ client_test "NFSv3 root=nfs nfsroot=/nfs/%s" 52:54:00:12:34:04 \
+ "root=nfs nfsroot=/nfs/%s" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=nfs nfsroot=/nfs/ip/%s no host name (use IP)" \
+ 52:54:00:12:34:7f \
+ "root=nfs nfsroot=/nfs/ip/%s \
+ ip=192.168.50.101:192.168.50.1::255.255.255.0::eth0:static" \
+ 192.168.50.1 -wsize=4096 || return 1
+
client_test "NFSv3 root=nfs nfsroot=/nfs/client,wsize=4096" \
52:54:00:12:34:04 "root=nfs nfsroot=/nfs/client,wsize=4096" \
192.168.50.1 wsize=4096 || return 1
52:54:00:12:34:84 "root=nfs4 nfsroot=/client,wsize=4096" \
192.168.50.1 wsize=4096 || return 1
+ # This one only works with NFSv4 in the test suite -- NFSv3 needs
+ # a /nfs prefix due to our server configuration
+ client_test "NFSv4 root=nfs4" 52:54:00:12:34:84 \
+ "root=nfs4" 192.168.50.1 -wsize=4096 || return 1
+
client_test "NFSv4 root=nfs4 DHCP path,options" \
52:54:00:12:34:85 "root=nfs4" 192.168.50.1 wsize=4096 || return 1
ldconfig -n -r "$initdir" /lib* /usr/lib*
)
+ mkdir -p mnt/nfs/nfs3-5
+ mkdir -p mnt/nfs/ip/192.168.50.101
+ mkdir -p mnt/nfs/tftpboot/nfs4-5
+
sudo umount mnt
rm -fr mnt