Hello list,

for the option ipaddress,
the separator for different interfaces in the option ipaddress is set to ":" 
colon
but that character could be part of the interface name, as example eth0:0
I suggest the separator should be a semi-colon ";"

the gateway is obligatory, local-only networks does not have a gateway

the domain name and the nameservers could be specified using this patch,

that is the format proposed, observe that the optional part starts at gateway

ipaddress="iface1,address1,netmask1,gateway1,domainname1,nameserver11,nameserver12;
iface2,address2,netmask2,gateway2,domainname2,nameserver21,nameserver22;..."

Best regards,

Jordi Pujol
--- initrd-110-7-orig/scripts/live-bottom/23networking	2007-11-19 10:58:26.000000000 +0100
+++ initrd/scripts/live-bottom/23networking	2007-12-04 20:30:12.000000000 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#set -e
+[ -n "${DEBUG}" ] && set -x
 
 # initramfs-tools header
 
@@ -20,7 +20,7 @@
 
 # live-initramfs header
 
-if [ -n "${NONETWORKING}" ]
+if [ "${NONETWORKING}" = "Yes" ]
 then
 	exit 0
 fi
@@ -31,7 +31,7 @@
 
 # live-initramfs script
 
-IFFILE="/root/etc/network/interfaces"
+IFFILE="${rootmnt}/etc/network/interfaces"
 
 if [ "${STATICIP}" = "frommedia" -a -e  "${IFFILE}" ]
 then
@@ -51,7 +51,11 @@
 
 if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]
 then
-	parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
+	parsed=$(echo "${STATICIP}" | sed -e 's/;/ /g')
+	rc_domain=
+	rc_search=
+	rc_server0=
+	rc_server1=
 
 	for ifline in ${parsed}
 	do
@@ -59,17 +63,41 @@
 		ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
 		ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
 		ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
+		[ -n "${ifgateway}" ] && gateway="	gateway ${ifgateway}" || gateway=
 
 cat >> "${IFFILE}" << EOF
 auto ${ifname}
 iface ${ifname} inet static
-    address ${ifaddress}
-    netmask ${ifnetmask}
-    gateway ${ifgateway}
+	address ${ifaddress}
+	netmask ${ifnetmask}
+${gateway}
 
 EOF
-
+		if_domain="$(echo ${ifline} | cut -f5 -d ',')"
+		if_server0="$(echo ${ifline} | cut -f6 -d ',')"
+		if_server1="$(echo ${ifline} | cut -f7 -d ',')"
+		[ -n "${if_domain}" -a -z "${rc_domain}" ] && rc_domain="${if_domain}"
+		[ -n "${if_domain}" ] && rc_search="${rc_search}${if_domain} "
+		if [ -n "${if_server0}" ]; then
+			if [ -z "${rc_server0}" ]; then
+				rc_server0="${if_server0}"
+			else
+				[ -z "${rc_server1}" ] && rc_server1="${if_server0}"
+			fi
+		fi
+		[ -n "${if_server1}" -a -z "${rc_server1}" ] && rc_server1="${if_server1}"
+		[ -z "${rc_server0}" -a -n "${ifgateway}" ] && rc_server0="${ifgateway}"
+	
 	done
+	if [ ! -f ${rootmnt}/etc/resolv.conf ]; then
+		echo "# /etc/resolv.conf" > ${rootmnt}/etc/resolv.conf
+		echo "# Autogenerated by live-initramfs" >> ${rootmnt}/etc/resolv.conf
+		[ -n "${rc_search}" ] && echo "search ${rc_search}" >> ${rootmnt}/etc/resolv.conf
+		[ -n "${rc_domain}" ] && echo "domain ${rc_domain}" >> ${rootmnt}/etc/resolv.conf
+		[ -n "${rc_server0}" ] && echo "nameserver ${rc_server0}" >> ${rootmnt}/etc/resolv.conf
+		[ -n "${rc_server1}" ] && echo "nameserver ${rc_server1}" >> ${rootmnt}/etc/resolv.conf
+		sed -i -e "s/127.0.0.1.*/127.0.0.1 localhost ${HOSTNAME}.${rc_domain} ${HOSTNAME}/" ${rootmnt}/etc/hosts
+	fi
 else
 	if [ -z "${NETBOOT}" ]
 	then
@@ -82,7 +110,7 @@
 	fi
 
 	# iterate the physical interfaces and add them to the interfaces list
-	if [ "${method}" != dhcp ] || [ ! -x /root/usr/sbin/NetworkManager ]
+	if [ "${method}" != dhcp ] || [ ! -x ${rootmnt}/usr/sbin/NetworkManager ]
 	then
 		for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
 		do
@@ -98,10 +126,10 @@
 		done
 	fi
 
-	if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ]
+	if [ ! -f ${rootmnt}/etc/resolv.conf -a -f /netboot.config ]
 	then
 		# create a resolv.conf if it is not present
-		cp /netboot.config /root/var/log/netboot.config
+		cp /netboot.config ${rootmnt}/var/log/netboot.config
 
 		rc_search=$(cat netboot.config | awk '/domain/{print $3}')
 		rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
@@ -115,7 +143,7 @@
 			rc_server1="nameserver ${rc_server1}"
 		fi
 
-cat > /root/etc/resolv.conf << EOF
+		cat > ${rootmnt}/etc/resolv.conf << EOF
 # /etc/resolv.conf
 # Autogenerated by live-initramfs
 search ${rc_search}
@@ -124,11 +152,11 @@
 ${rc_server1}
 EOF
 
-		cat /root/etc/resolv.conf >> /root/var/log/netboot.config
+		cat ${rootmnt}/etc/resolv.conf >> ${rootmnt}/var/log/netboot.config
 	fi
 fi
 
-#if [ ! -x /root/usr/sbin/NetworkManager ]
+#if [ ! -x ${rootmnt}/usr/sbin/NetworkManager ]
 #then
 #	for i in eth0 eth1 eth2 ath0 wlan0
 #	do
_______________________________________________
debian-live-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

Reply via email to