7 if [ -n "${NONETWORKING}" ]
12 # FIXME: stop hardcoding overloading of initramfs-tools functions
14 . /lib/live/boot/9990-initramfs-tools.sh
16 log_begin_msg "Preconfiguring networking"
18 IFFILE="/root/etc/network/interfaces"
20 if [ "${STATICIP}" = "frommedia" ] && [ -e "${IFFILE}" ]
22 # will use existent /etc/network/interfaces
27 cat > "${IFFILE}" << EOF
29 iface lo inet loopback
36 if [ -z "${NETBOOT}" ] && [ -n "${STATICIP}" ] && [ "${STATICIP}" != "frommedia" ]
38 parsed=$(echo "${STATICIP}" | sed -e 's|,| |g')
40 for ifline in ${parsed}
42 ifname="$(echo ${ifline} | cut -f1 -d ':')"
43 ifaddress="$(echo ${ifline} | cut -f2 -d ':')"
44 ifnetmask="$(echo ${ifline} | cut -f3 -d ':')"
45 ifgateway="$(echo ${ifline} | cut -f4 -d ':')"
47 cat >> "${IFFILE}" << EOF
48 allow-hotplug ${ifname}
49 iface ${ifname} inet static
54 if [ -n "${ifgateway}" ]
57 cat >> "${IFFILE}" << EOF
65 if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ]
67 # default, dhcp assigned
70 # make sure that the preconfigured interface would not get reassigned by dhcp
71 # on startup by ifup script - otherwise our root fs might be disconnected!
75 # iterate the physical interfaces and add them to the interfaces list and also add when ethdevice= called on cmdline
76 if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ]) || [ ! -z "${ETHDEVICE}" ]
78 for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
80 [ -e ${interface} ] || continue
81 i="$(basename ${interface})"
83 cat >> "${IFFILE}" << EOF
85 iface ${i} inet ${method}
92 if [ ! -f /root/etc/resolv.conf ] || [ -z "$(cat /root/etc/resolv.conf)" ]
94 if [ -f /netboot.config ]
96 # create a resolv.conf if it is not present or empty
97 cp /netboot.config /root/var/log/netboot.config
99 rc_search=$(cat netboot.config | awk '/domain/{print $3}')
100 rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
101 rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
102 rc_server0="nameserver ${rc_server0}"
104 if [ "${rc_server1}" = "0.0.0.0" ]
108 rc_server1="nameserver ${rc_server1}"
111 cat > /root/etc/resolv.conf << EOF
113 # Autogenerated by live-boot
120 cat /root/etc/resolv.conf >> /root/var/log/netboot.config
125 #if [ ! -x /root/usr/sbin/NetworkManager ]
127 # for i in eth0 eth1 eth2 ath0 wlan0
129 # grep -q "iface ${i}" ${IFFILE} && continue
131 #cat >> "${IFFILE}" << EOF
133 #iface ${i} inet dhcp