5 # initramfs-tools header
21 # live-initramfs header
23 if [ -n "${NONETWORKING}" ]
28 . /scripts/live-functions
30 log_begin_msg "Preconfiguring networking"
32 # live-initramfs script
34 IFFILE="/root/etc/network/interfaces"
36 if [ "${STATICIP}" = "frommedia" -a -e "${IFFILE}" ]
38 # will use existent /etc/network/interfaces
43 cat > "${IFFILE}" << EOF
45 iface lo inet loopback
49 if [ -x /sbin/udevadm ]
60 if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]
62 parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
64 for ifline in ${parsed}
66 ifname="$(echo ${ifline} | cut -f1 -d ',')"
67 ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
68 ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
69 ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
71 cat >> "${IFFILE}" << EOF
73 iface ${ifname} inet static
82 if [ -z "${NETBOOT}" ]
84 # default, dhcp assigned
87 # make sure that the preconfigured interface would not get reassigned by dhcp
88 # on startup by ifup script - otherwise our root fs might be disconnected!
92 # iterate the physical interfaces and add them to the interfaces list
93 if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ])
95 for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
97 [ -e ${interface} ] || continue
98 i="$(basename ${interface})"
100 cat >> "${IFFILE}" << EOF
102 iface ${i} inet ${method}
109 if [ ! -f /root/etc/resolv.conf ] || [ -z "$(cat /root/etc/resolv.conf)" ]
111 if [ -f /netboot.config ]
113 # create a resolv.conf if it is not present or empty
114 cp /netboot.config /root/var/log/netboot.config
116 rc_search=$(cat netboot.config | awk '/domain/{print $3}')
117 rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
118 rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
119 rc_server0="nameserver ${rc_server0}"
121 if [ "${rc_server1}" = "0.0.0.0" ]
125 rc_server1="nameserver ${rc_server1}"
128 cat > /root/etc/resolv.conf << EOF
130 # Autogenerated by live-initramfs
137 cat /root/etc/resolv.conf >> /root/var/log/netboot.config
142 #if [ ! -x /root/usr/sbin/NetworkManager ]
144 # for i in eth0 eth1 eth2 ath0 wlan0
146 # grep -q "iface ${i}" ${IFFILE} && continue
148 #cat >> "${IFFILE}" << EOF
150 #iface ${i} inet dhcp