1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 15_networking_grml.dpatch by Christian Hofstaedtler <ch@grml.org>
3 ## Licensed under GPLv2+.
5 ## All lines beginning with `## DP:' are a description of the patch.
6 ## DP: Ship our own networking script, which is compatible with the kernel's
7 ## DP: notion of ip= as well as resolvconf.
11 diff a/scripts/live-bottom/23networking_grml b/scripts/live-bottom/23networking_grml
13 +++ b/scripts/boot/9990-grml-networking.sh
21 +if [ -n "${NONETWORKING}" ]; then
25 +modprobe af_packet # req'd for DHCP
28 +# (this /might/ be required for firmware loading to complete)
29 +if grep -q noudev /proc/cmdline; then
30 + log_begin_msg "Networking: Skipping udev as requested via bootoption noudev."
36 +if [ -n "${IP}" ]; then
37 + # call into initramfs-tools provided network setup functions, so basic
38 + # networking is fine.
39 + log_begin_msg "Networking: Waiting for basic network to come up..."
40 + configure_networking
43 +# prepare a new /etc/network/interfaces file (and, possibly, a new /etc/resolv.conf)
44 +IFFILE="/root/etc/network/interfaces"
45 +RESOLVCONF="/root/etc/resolv.conf"
47 +# config for loopback networking
49 +# Initially generated on boot by initramfs' 23networking.
52 +iface lo inet loopback
58 +# generate config for each present network device
59 +for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do
60 + [ -e ${interface} ] || continue
61 + interface=$(basename ${interface})
64 + # NODHCP or a previously run ipconfig mean that ifupdown should never
65 + # touch this interface (IP-stack wise).
66 + netconfig=/run/net-${interface}.conf
67 + if [ -n "$NODHCP" ] || [ -e "${netconfig}" ]; then
71 + cat >> $IFFILE << EOF
72 +allow-hotplug ${interface}
73 +iface ${interface} inet ${method}
76 + # DNS for resolvconf and /etc/resolv.conf
77 + if [ -e "${netconfig}" ]; then
79 + if [ -n "${DNSDOMAIN}" ]; then
80 + echo " dns-search ${DNSDOMAIN}" >> $IFFILE
82 + # make sure we don't have any 0.0.0.0 nameservers
84 + for IPV4DNS in ${IPV4DNS0} ${IPV4DNS1}; do
85 + [ -n "${IPV4DNS}" ] || continue
86 + [ "${IPV4DNS}" != "0.0.0.0" ] || continue
87 + IPV4DNSLIST="${IPV4DNSLIST}${IPV4DNS} "
89 + if [ -n "${IPV4DNSLIST}" ]; then
90 + echo " dns-nameservers ${IPV4DNSLIST}" >> $IFFILE
91 + for IPV4DNS in ${IPV4DNSLIST}; do
92 + echo "nameserver ${IPV4DNS}" >> $RESOLVCONF
97 + if [ -z "$NODHCPHOSTNAME" -a -n "$HOSTNAME" ]; then
98 + echo $HOSTNAME > /root/etc/hostname
101 + unset DEVICE IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1 HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH filename
102 + unset IPV4DNS IPV4DNSLIST
108 diff --git a/scripts/boot/9990-main.sh b/scripts/boot/9990-main.sh
109 index ef41fb0..2af5eb6 100755
110 --- a/scripts/boot/9990-main.sh
111 +++ b/scripts/boot/9990-main.sh
112 @@ -194,6 +194,8 @@ Main ()
120 umount "${rootmnt}/dev"