Here is a beginning, I wonder what others think about replacing
"debian-live" with the Documentation/nfsroot.txt syntax a little bit
extended with possibility to chain devices declarations.
What's done is :
1) get what interface has to be used for dhcp (first found, the one
used) in scripts/live, just before mounting rootfs.
2) auto-fill /etc/network/interfaces from scripts/live-bottom/23networking
device_declaration :
<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
ip=<device_declaration1>,<device_declaration2>,...
e.g :
append [...] ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp
--
Mathieu
--- scripts/live-bottom/23networking.orig 2007-06-25 23:52:00.000000000 +0200
+++ scripts/live-bottom/23networking 2007-06-25 23:50:46.000000000 +0200
@@ -28,7 +28,7 @@
IFFILE="/root/etc/network/interfaces"
-if [ "${STATICIP}" = "frommedia" -a -e "$IFFILE" ] ; then
+if [ "${IPOPTS}" = "frommedia" -a -e "$IFFILE" ] ; then
# will use existent /etc/network/interfaces
log_end_msg
exit 0
@@ -42,23 +42,39 @@
udevtrigger
udevsettle
-
-if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then
- parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
- for ifline in ${parsed}; do
- ifname="$(echo ${ifline} | cut -f1 -d ',')"
- ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
- ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
- ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
- cat >> "$IFFILE" <<EOF
-auto ${ifname}
-iface ${ifname} inet static
+if [ -n "${IPOPTS}" -a "${IPOPTS}" != "frommedia" ]; then
+ OLDIFS=${IFS}
+ IFS=","
+ echo "plop: ${IPOPTS} ${NETBOOT}" > /root/root/test
+ for ifline in ${IPOPTS}; do
+ ifaddress="$(echo ${ifline} | cut -f1 -d ':')"
+ serverip="$(echo ${ifline} | cut -f2 -d ':')"
+ ifgateway="$(echo ${ifline} | cut -f3 -d ':')"
+ ifnetmask="$(echo ${ifline} | cut -f4 -d ':')"
+ ifname="$(echo ${ifline} | cut -f5 -d ':')"
+ ifdevice="$(echo ${ifline} | cut -f6 -d ':')"
+ ifmode="$(echo ${ifline} | cut -f7 -d ':')"
+
+ # static
+ if [ "$ifaddress" != "" -a "$ifmode" == "" ]; then
+ cat >> /root/etc/network/interfaces <<EOF
+auto ${ifdevice}
+iface ${ifdevice} inet static
address ${ifaddress}
netmask ${ifnetmask}
gateway ${ifgateway}
EOF
+ fi
+ if [ "$ifmode" = "dhcp" ]; then
+ cat >> /root/etc/network/interfaces <<EOF
+auto ${ifdevice}
+iface ${ifdevice} inet $ifmode
+
+EOF
+ fi
done
+ IFS=${OLDIFS}
else
if [ -z "${NETBOOT}" ]; then
--- scripts/live.orig 2007-06-25 23:51:46.000000000 +0200
+++ scripts/live 2007-06-25 23:27:34.000000000 +0200
@@ -35,6 +35,7 @@
PRESEEDS=
# looking for live-initramfs specifics options as kernel parameters
for x in $(cat /proc/cmdline); do
+
case $x in
userfullname=*)
export USERFULLNAME=${x#userfullname=}
@@ -74,12 +75,38 @@
export PERSISTENT="Yes" ;;
nopersistent)
export PERSISTENT="" ;;
- ip*)
- STATICIP=${x#ip=}
- if [ "${STATICIP}" = "" ]; then
- STATICIP="frommedia"
- fi
- export STATICIP ;;
+ ip=*)
+ export IPOPTS="${x#ip=}"
+ case ${IPOPTS} in
+ none|off)
+ # Do nothing
+ ;;
+ ""|on|any)
+ # Bring up device
+ echo "ipconfig ${DEVICE}"
+ ;;
+ dhcp|bootp|rarp|both)
+ echo "ipconfig -c ${IPOPTS} -d ${DEVICE}"
+ ;;
+ *)
+ echo "ipconfig -d $IPOPTS"
+
+ # grab first dhcp device entry
+ OLDIFS=${IFS}
+ IFS=","
+ for ipspec in $IPOPTS; do
+ case $ipspec in
+ *:dhcp)
+ DEVICE=${ipspec#*:*:*:*:*:*}
+ DEVICE=${DEVICE%*:*}
+ break
+ ;;
+ esac
+ done
+ IFS=${OLDIFS}
+ ;;
+ esac
+ ;;
live-getty)
export LIVE_GETTY=1 ;;
_______________________________________________
Debian-live-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel