From 40dff93a37953768754af4d9dc0a3706e292aba2 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Thu, 9 Dec 2010 16:38:26 +0100 Subject: [PATCH] don't mess around with kernel/initramfs-tools' ip= instead, leave alone what the kernel configures, and make DNS available to the target root (for ip=dhcp/netboot) --- debian/patches/00list | 5 +- debian/patches/09_bootoption_noudev.dpatch | 27 ----- debian/patches/15_networking_grml.dpatch | 111 +++++++++++++++++++++ .../patches/15_remove_resolv_conf_symlink.dpatch | 35 ------- debian/patches/16_always_honor_nodhcp.dpatch | 35 ------- debian/patches/16_nodhcp.dpatch | 22 ++++ debian/rules | 1 + 7 files changed, 136 insertions(+), 100 deletions(-) delete mode 100755 debian/patches/09_bootoption_noudev.dpatch create mode 100755 debian/patches/15_networking_grml.dpatch delete mode 100755 debian/patches/15_remove_resolv_conf_symlink.dpatch delete mode 100755 debian/patches/16_always_honor_nodhcp.dpatch create mode 100755 debian/patches/16_nodhcp.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 7cb969e..a77d98f 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -2,11 +2,10 @@ 05_boot_failure_message_grml.dpatch 07_support_findiso.dpatch 08_grml_defaults.dpatch -09_bootoption_noudev.dpatch 10_validateroot.dpatch 11_dhcphostname.dpatch 12_uuid_support.dpatch 13_always_display_warnings_and_failures.dpatch 14_no_blkid_on_lenny.dpatch -15_remove_resolv_conf_symlink.dpatch -16_always_honor_nodhcp.dpatch +15_networking_grml.dpatch +16_nodhcp.dpatch diff --git a/debian/patches/09_bootoption_noudev.dpatch b/debian/patches/09_bootoption_noudev.dpatch deleted file mode 100755 index e1796dd..0000000 --- a/debian/patches/09_bootoption_noudev.dpatch +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 09_bootoption_noudev.dpatch by Christian Hofstaedtler -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: honor bootoption "noudev" - -@DPATCH@ -diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking -index 9554b77..f85b29e 100755 ---- a/scripts/live-bottom/23networking -+++ b/scripts/live-bottom/23networking -@@ -46,8 +46,13 @@ iface lo inet loopback - - EOF - --udevadm trigger --udevadm settle -+if grep -q noudev /proc/cmdline -+then -+ log_begin_msg "Skipping udev as requested via bootoption noudev." -+else -+ udevadm trigger -+ udevadm settle -+fi - - if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ] - then diff --git a/debian/patches/15_networking_grml.dpatch b/debian/patches/15_networking_grml.dpatch new file mode 100755 index 0000000..d0f739d --- /dev/null +++ b/debian/patches/15_networking_grml.dpatch @@ -0,0 +1,111 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 15_networking_grml.dpatch by Christian Hofstaedtler +## Licensed under GPLv2+. +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Ship our own networking script, which is compatible with the kernel's +## DP: notion of ip= as well as resolvconf. + +@DPATCH@ + +diff a/scripts/live-bottom/23networking_grml b/scripts/live-bottom/23networking_grml +--- /dev/null ++++ b/scripts/live-bottom/23networking_grml +@@ -0,0 +1,97 @@ ++#!/bin/sh ++ ++#set -e ++ ++# initramfs-tools header ++ ++PREREQ="" ++ ++prereqs() ++{ ++ echo "${PREREQ}" ++} ++ ++case "${1}" in ++ prereqs) ++ prereqs ++ exit 0 ++ ;; ++esac ++ ++. /scripts/live-functions ++ ++if [ -n "${NONETWORKING}" ]; then ++ exit 0 ++fi ++ ++modprobe af_packet # req'd for DHCP ++ ++# initialize udev ++# (this /might/ be required for firmware loading to complete) ++if grep -q noudev /proc/cmdline; then ++ log_begin_msg "Networking: Skipping udev as requested via bootoption noudev." ++else ++ udevadm trigger ++ udevadm settle ++fi ++ ++if [ -n "${IP}" ]; then ++ # call into initramfs-tools provided network setup functions, so basic ++ # networking is fine. ++ log_begin_msg "Networking: Waiting for basic network to come up..." ++ configure_networking ++fi ++ ++# prepare a new /etc/network/interfaces file ++IFFILE="/root/etc/network/interfaces" ++ ++# config for loopback networking ++cat > $IFFILE << EOF ++# Initially generated on boot by initramfs' 23networking. ++ ++auto lo ++iface lo inet loopback ++ ++EOF ++ ++# generate config for each present network device ++for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do ++ [ -e ${interface} ] || continue ++ interface=$(basename ${interface}) ++ method="dhcp" ++ ++ # NODHCP or a previously run ipconfig mean that ifupdown should never ++ # touch this interface (IP-stack wise). ++ netconfig=/tmp/net-${interface}.conf ++ if [ -n "$NODHCP" ] || [ -e "${netconfig}" ]; then ++ method="manual" ++ fi ++ ++ cat >> $IFFILE << EOF ++allow-hotplug ${interface} ++iface ${interface} inet ${method} ++EOF ++ ++ # DNS for resolvconf ++ if [ -e "${netconfig}" ]; then ++ . "${netconfig}" ++ if [ -n "${DNSDOMAIN}" ]; then ++ echo " dns-search ${DNSDOMAIN}" >> $IFFILE ++ fi ++ IPV4DNSLIST="" ++ for IPV4DNS in ${IPV4DNS0} ${IPV4DNS1}; do ++ [ -n "${IPV4DNS}" ] || continue ++ [ "${IPV4DNS}" != "0.0.0.0" ] || continue ++ IPV4DNSLIST="${IPV4DNSLIST}${IPV4DNS} " ++ done ++ if [ -n "${IPV4DNSLIST}" ]; then ++ echo " dns-nameservers ${IPV4DNSLIST}" >> $IFFILE ++ fi ++ fi ++ unset DEVICE IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1 HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH filename ++ unset IPV4DNS IPV4DNSLIST ++ ++ echo>> $IFFILE ++done ++ ++ diff --git a/debian/patches/15_remove_resolv_conf_symlink.dpatch b/debian/patches/15_remove_resolv_conf_symlink.dpatch deleted file mode 100755 index 3bd9bac..0000000 --- a/debian/patches/15_remove_resolv_conf_symlink.dpatch +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 15_remove_resolv_conf_symlink.dpatch by Michael Prokop -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: fix resolvconf handling when booting via PXE -## -## When installing grml for PXE boot the system has network after -## boot but no usable DNS. /etc/resolv.conf is empty except the -## warning to not edit this file manually but to use the resolvconf -## tool. -## -## The problem is, that the 23networking scripte in the initrd -## correctly creates the resolv.conf, but it's being overwritten by -## the resolvconf utility on boot. -## -## The fix for now is to remove the symlink so resolvconf breaks -## early and DNS is working then. - -@DPATCH@ -diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking -index 9554b77..70ea6e7 100755 ---- a/scripts/live-bottom/23networking -+++ b/scripts/live-bottom/23networking -@@ -110,6 +110,11 @@ EOF - then - if [ -f /netboot.config ] - then -+ if [ -h /root/etc/resolv.conf ] -+ then -+ rm /root/etc/resolv.conf -+ fi -+ - # create a resolv.conf if it is not present or empty - cp /netboot.config /root/var/log/netboot.config - diff --git a/debian/patches/16_always_honor_nodhcp.dpatch b/debian/patches/16_always_honor_nodhcp.dpatch deleted file mode 100755 index 80a2522..0000000 --- a/debian/patches/16_always_honor_nodhcp.dpatch +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 16_always_honor_nodhcp.dpatch by Ulrich Dangel -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Always honor the nodhcp boot option - -@DPATCH@ - -diff --git a/scripts/live b/scripts/live -index d79beed..0b698de 100755 ---- a/scripts/live -+++ b/scripts/live -@@ -83,7 +83,8 @@ Arguments () - ;; - - nodhcp) -- unset DHCP -+ NODHCP="Yes" -+ export NODHCP - ;; - - ethdevice=*) -diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking -index 9554b77..a29df57 100755 ---- a/scripts/live-bottom/23networking -+++ b/scripts/live-bottom/23networking -@@ -79,7 +79,7 @@ fi - - done - else -- if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ] -+ if ( [ -z "${NETBOOT}" ] && [ -z "${NODHCP}" ] ) || [ -n "${DHCP}" ] - then - # default, dhcp assigned - method="dhcp" diff --git a/debian/patches/16_nodhcp.dpatch b/debian/patches/16_nodhcp.dpatch new file mode 100755 index 0000000..7558a89 --- /dev/null +++ b/debian/patches/16_nodhcp.dpatch @@ -0,0 +1,22 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 16_nodhcp.dpatch by Ulrich Dangel +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Handle explicit "nodhcp" + +@DPATCH@ + +diff --git a/scripts/live b/scripts/live +index d79beed..0b698de 100755 +--- a/scripts/live ++++ b/scripts/live +@@ -83,7 +83,8 @@ Arguments () + ;; + + nodhcp) +- unset DHCP ++ NODHCP="Yes" ++ export NODHCP + ;; + + ethdevice=*) diff --git a/debian/rules b/debian/rules index fd55dcf..e2bbc18 100755 --- a/debian/rules +++ b/debian/rules @@ -28,6 +28,7 @@ override_dh_auto_install: # Some more useless files rm -f debian/live-boot-initramfs-tools/usr/share/initramfs-tools/scripts/live-bottom/12fstab + rm -f debian/live-boot-initramfs-tools/usr/share/initramfs-tools/scripts/live-bottom/23networking rm -f debian/live-boot-initramfs-tools/usr/share/initramfs-tools/scripts/live-bottom/24preseed rm -f debian/live-boot-initramfs-tools/usr/share/initramfs-tools/scripts/live-bottom/30accessibility -- 2.1.4