Fix legacy root=/dev/nfs nfsroot=IP:path case

TODO: root=/dev/nfs DHCP cases are still broken.
master
Warren Togami 2009-06-30 18:22:44 -04:00
parent 6da2ee08a6
commit 9d4c1799fe
2 changed files with 15 additions and 14 deletions

View File

@ -72,15 +72,6 @@ netroot_to_var() {
[ -z "$netroot" ] && netroot=$(getarg netroot=)
[ -z "$nfsroot" ] && nfsroot=$(getarg nfsroot=)

# nfsroot= is valid only if root=/dev/nfs
if [ -n "$nfsroot" ] ; then
# @deprecated
warn "Argument nfsroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
if [ "$(getarg root=)" != "/dev/nfs" ]; then
die "Argument nfsroot only accepted for legacy root=/dev/nfs"
fi
fi

# netroot= cmdline argument must be ignored, but must be used if
# we're inside netroot to parse dhcp root-path
if [ -n "$netroot" ] ; then
@ -92,7 +83,17 @@ else
netroot=$root;
fi

# Handle old style <server-ip>:/<path
# LEGACY convert nfsroot= is valid only if root=/dev/nfs
if [ -n "$nfsroot" ] ; then
# @deprecated
warn "Argument nfsroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
if [ "$(getarg root=)" != "/dev/nfs" ]; then
die "Argument nfsroot only accepted for legacy root=/dev/nfs"
fi
netroot=nfs:$nfsroot;
fi

# LEGACY convert root=<server-ip>:/<path
case "$netroot" in
[0-9]*:/*|[0-9]*\.[0-9]*\.[0-9]*[!:]|/*)
netroot=nfs:$netroot;;

View File

@ -104,10 +104,10 @@ test_nfsv3() {
client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
"root=dhcp" 192.168.50.1 -wsize=4096 || return 1

# XXX: Temporarily not supported during refactoring
# client_test "NFSv3 Legacy root=/dev/nfs nfsroot=IP:path" 52:54:00:12:34:01 \
# "root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
#
client_test "NFSv3 Legacy root=/dev/nfs nfsroot=IP:path" 52:54:00:12:34:01 \
"root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1

# XXX Fix me
# client_test "NFSv3 Legacy root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
# "root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
#