[SCM] live-boot branch, debian-next, updated. debian/3.0_a29-1-17-g40fc0c3
Daniel Baumann
daniel at debian.org
Tue Jun 5 17:21:29 UTC 2012
The following commit has been merged in the debian-next branch:
commit 40fc0c3eac40d783f65bd7538a4d07503ec1e182
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Jun 5 19:21:28 2012 +0200
Transforming networking bottom script into normal live-boot script.
diff --git a/Makefile b/Makefile
index e202f85..2241dce 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ SHELL := sh -e
LANGUAGES = $(shell cd manpages/po && ls)
-SCRIPTS = bin/* initramfs-tools/hooks/* initramfs-tools/scripts/live initramfs-tools/scripts/*/* scripts/*.sh scripts/*/*
+SCRIPTS = bin/* initramfs-tools/hooks/* initramfs-tools/scripts/live scripts/*.sh scripts/*/*
all: build
diff --git a/initramfs-tools/scripts/live-bottom/23networking b/initramfs-tools/scripts/live-bottom/23networking
deleted file mode 100755
index 7fca6ff..0000000
--- a/initramfs-tools/scripts/live-bottom/23networking
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/sh
-
-#set -e
-
-# initramfs-tools header
-
-PREREQ=""
-
-prereqs()
-{
- echo "${PREREQ}"
-}
-
-case "${1}" in
- prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-# live-boot header
-
-if [ -n "${NONETWORKING}" ]
-then
- exit 0
-fi
-
-# FIXME: stop hardcoding overloading of initramfs-tools functions
-. /scripts/functions
-. /lib/live/boot/initramfs-tools.sh
-
-log_begin_msg "Preconfiguring networking"
-
-# live-boot script
-
-IFFILE="/root/etc/network/interfaces"
-
-if [ "${STATICIP}" = "frommedia" -a -e "${IFFILE}" ]
-then
- # will use existent /etc/network/interfaces
- log_end_msg
- exit 0
-fi
-
-cat > "${IFFILE}" << EOF
-auto lo
-iface lo inet loopback
-
-EOF
-
-udevadm trigger
-udevadm settle
-
-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
-allow-hotplug ${ifname}
-iface ${ifname} inet static
- address ${ifaddress}
- netmask ${ifnetmask}
-EOF
-
-if [ -n "${ifgateway}" ]
-then
-
-cat >> "${IFFILE}" << EOF
- gateway ${ifgateway}
-
-EOF
-
-fi
-
- done
-else
- if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ]
- then
- # default, dhcp assigned
- method="dhcp"
- else
- # make sure that the preconfigured interface would not get reassigned by dhcp
- # on startup by ifup script - otherwise our root fs might be disconnected!
- method="manual"
- fi
-
- # iterate the physical interfaces and add them to the interfaces list and also add when ethdevice= called on cmdline
- if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ]) || [ ! -z "${ETHDEVICE}" ]
- then
- for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
- do
- [ -e ${interface} ] || continue
- i="$(basename ${interface})"
-
-cat >> "${IFFILE}" << EOF
-allow-hotplug ${i}
-iface ${i} inet ${method}
-
-EOF
-
- done
- fi
-
- if [ ! -f /root/etc/resolv.conf ] || [ -z "$(cat /root/etc/resolv.conf)" ]
- then
- if [ -f /netboot.config ]
- then
- # create a resolv.conf if it is not present or empty
- cp /netboot.config /root/var/log/netboot.config
-
- rc_search=$(cat netboot.config | awk '/domain/{print $3}')
- rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
- rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
- rc_server0="nameserver ${rc_server0}"
-
- if [ "${rc_server1}" = "0.0.0.0" ]
- then
- rc_server1=""
- else
- rc_server1="nameserver ${rc_server1}"
- fi
-
-cat > /root/etc/resolv.conf << EOF
-# /etc/resolv.conf
-# Autogenerated by live-boot
-search ${rc_search}
-domain ${rc_search}
-${rc_server0}
-${rc_server1}
-EOF
-
- cat /root/etc/resolv.conf >> /root/var/log/netboot.config
- fi
- fi
-fi
-
-#if [ ! -x /root/usr/sbin/NetworkManager ]
-#then
-# for i in eth0 eth1 eth2 ath0 wlan0
-# do
-# grep -q "iface ${i}" ${IFFILE} && continue
-#
-#cat >> "${IFFILE}" << EOF
-#allow-hotplug ${i}
-#iface ${i} inet dhcp
-#
-#EOF
-#
-# done
-#fi
-
-log_end_msg
diff --git a/scripts/boot.sh b/scripts/boot.sh
index 1883950..736e587 100755
--- a/scripts/boot.sh
+++ b/scripts/boot.sh
@@ -637,12 +637,7 @@ mountroot ()
persistence_exclude
fstab
-
- maybe_break live-bottom
- log_begin_msg "Running /scripts/live-bottom\n"
-
- run_scripts /scripts/live-bottom
- log_end_msg
+ Netbase
case "${LIVE_SWAPON}" in
true)
diff --git a/scripts/boot/netbase.sh b/scripts/boot/netbase.sh
new file mode 100755
index 0000000..0528817
--- /dev/null
+++ b/scripts/boot/netbase.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+#set -e
+
+Netbase ()
+{
+ if [ -n "${NONETWORKING}" ]
+ then
+ return
+ fi
+
+ # FIXME: stop hardcoding overloading of initramfs-tools functions
+ . /scripts/functions
+ . /lib/live/boot/initramfs-tools.sh
+
+ log_begin_msg "Preconfiguring networking"
+
+ IFFILE="/root/etc/network/interfaces"
+
+ if [ "${STATICIP}" = "frommedia" -a -e "${IFFILE}" ]
+ then
+ # will use existent /etc/network/interfaces
+ log_end_msg
+ return
+ fi
+
+cat > "${IFFILE}" << EOF
+auto lo
+iface lo inet loopback
+
+EOF
+
+ udevadm trigger
+ udevadm settle
+
+ 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
+allow-hotplug ${ifname}
+iface ${ifname} inet static
+ address ${ifaddress}
+ netmask ${ifnetmask}
+EOF
+
+ if [ -n "${ifgateway}" ]
+ then
+
+cat >> "${IFFILE}" << EOF
+ gateway ${ifgateway}
+
+EOF
+
+ fi
+ done
+ else
+ if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ]
+ then
+ # default, dhcp assigned
+ method="dhcp"
+ else
+ # make sure that the preconfigured interface would not get reassigned by dhcp
+ # on startup by ifup script - otherwise our root fs might be disconnected!
+ method="manual"
+ fi
+
+ # iterate the physical interfaces and add them to the interfaces list and also add when ethdevice= called on cmdline
+ if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ]) || [ ! -z "${ETHDEVICE}" ]
+ then
+ for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
+ do
+ [ -e ${interface} ] || continue
+ i="$(basename ${interface})"
+
+cat >> "${IFFILE}" << EOF
+allow-hotplug ${i}
+iface ${i} inet ${method}
+
+EOF
+
+ done
+ fi
+
+ if [ ! -f /root/etc/resolv.conf ] || [ -z "$(cat /root/etc/resolv.conf)" ]
+ then
+ if [ -f /netboot.config ]
+ then
+ # create a resolv.conf if it is not present or empty
+ cp /netboot.config /root/var/log/netboot.config
+
+ rc_search=$(cat netboot.config | awk '/domain/{print $3}')
+ rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
+ rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
+ rc_server0="nameserver ${rc_server0}"
+
+ if [ "${rc_server1}" = "0.0.0.0" ]
+ then
+ rc_server1=""
+ else
+ rc_server1="nameserver ${rc_server1}"
+ fi
+
+cat > /root/etc/resolv.conf << EOF
+# /etc/resolv.conf
+# Autogenerated by live-boot
+search ${rc_search}
+domain ${rc_search}
+${rc_server0}
+${rc_server1}
+EOF
+
+ cat /root/etc/resolv.conf >> /root/var/log/netboot.config
+ fi
+ fi
+ fi
+
+ #if [ ! -x /root/usr/sbin/NetworkManager ]
+ #then
+ # for i in eth0 eth1 eth2 ath0 wlan0
+ # do
+ # grep -q "iface ${i}" ${IFFILE} && continue
+ #
+ #cat >> "${IFFILE}" << EOF
+ #allow-hotplug ${i}
+ #iface ${i} inet dhcp
+ #
+ #EOF
+ #
+ # done
+ #fi
+
+ log_end_msg
+}
--
live-boot
More information about the debian-live-changes
mailing list