[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#380649: initramfs-tools: complete patches for nfsroot.txt implementation



tags 380649 +patch
thanks

Package: initramfs-tools
Version: 0.75
Followup-For: Bug #380649

the ip= option turned out to be the easiest one. attached are two patches
that implement:

root=/dev/nfs

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

ip=""

ip="dhcp"
 
i didn't implement ip=rarp or ip=bootp, though i get the impression dhcp
can mimic bootp, and could possible used as an alias to dhcp.

i would say, with these patches applied, this bug could be closed.

of course, patches also available in bzr branch:

http://llama.freegeek.org/~vagrant/bzr-archives/initramfs-tools/vagrant-initramfs-tools

live well,
  vagrant
--- init	2006-08-18 22:41:33.000000000 -0400
+++ ../vagrant-initramfs-tools/init	2006-08-20 18:29:54.000000000 -0400
@@ -59,6 +59,9 @@
 		UUID=*)
 			ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
 			;;
+		/dev/nfs)
+			BOOT=nfs
+			;;
 		esac
 		;;
 	rootflags=*)
@@ -73,6 +76,9 @@
 	nfsopts=*)
 		NFSOPTS="-o ${x#nfsopts=}"
 		;;
+	ip=*)
+		IPOPTS=${x#ip=}
+		;;
 	boot=*)
 		BOOT=${x#boot=}
 		;;
--- scripts/nfs	2006-08-19 14:59:59.000000000 -0400
+++ ../vagrant-initramfs-tools/scripts/nfs	2006-08-20 18:36:46.000000000 -0400
@@ -13,10 +13,25 @@
 	# For DHCP
 	modprobe -q af_packet
 
-	ipconfig ${DEVICE}
+	if [ "x$IPOPTS" = "x" ] || [ "$IPOPTS" = "dhcp" ]; then
+		ipconfig ${DEVICE}
+	else
+		ipconfig $IPOPTS
+	fi
 	. /tmp/net-${DEVICE}.conf
 	if [ "x${NFSROOT}" = "xauto" ]; then
 		NFSROOT=${ROOTSERVER}:${ROOTPATH}
+	elif [ "x${NFSROOT}" != "x" ]; then
+		# support nfsroot option from linux sources Documentation/nfsroot.txt:
+		# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
+		if [ "x${NFSOPTS}" = "x" ] && [ "${NFSROOT#*,}" != "${NFSROOT}" ] ; then
+			NFSOPTS="-o ${NFSROOT#*,}"
+		fi
+		NFSROOT=${NFSROOT%%,*}
+		if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
+			# get rootserver from dhcp
+			NFSROOT=${ROOTSERVER}:${NFSROOT}
+		fi
 	fi
 
 	if [ "x${NFSOPTS}" = "x" ]; then

Reply to: