4 DESCRIPTION="Preconfiguring networking..."
5 IFFILE="/root/etc/network/interfaces"
7 . /scripts/casper-functions
22 log_begin_msg "$DESCRIPTION"
24 if [ "${STATICIP}" == "frommedia" -a -e "$IFFILE" ] ; then
25 # will use existent /etc/network/interfaces
32 iface lo inet loopback
36 if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then
37 udevtrigger -Bpci -Iclass="0x02*"
43 if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then
44 parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
45 for ifline in ${parsed}; do
46 ifname="$(echo ${ifline} | cut -f1 -d ',')"
47 ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
48 ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
49 ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
50 cat >> "$IFFILE" <<EOF
52 iface ${ifname} inet static
60 if [ -z "${NETBOOT}" ]; then
61 # default, dhcp assigned
64 # make sure that the preconfigured interface would not get reassigned by dhcp
65 # on startup by ifup script - otherwise our root fs might be disconnected!
69 # iterate the physical interfaces and add them to the interfaces list
70 for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do
71 [ -e $interface ] || continue
72 i="$(basename $interface)"
73 cat >> "$IFFILE" <<EOF
75 iface ${i} inet ${method}
79 if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ] ; then
80 # create a resolv.conf if it is not present
81 cp /netboot.config /root/var/log/netboot.config
82 rc_search=$(cat netboot.config | awk '/domain/{print $3}')
83 rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
84 rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
85 rc_server0="nameserver ${rc_server0}"
86 if [ "${rc_server1}" = "0.0.0.0" ]; then
89 rc_server1="nameserver ${rc_server1}"
91 cat > /root/etc/resolv.conf <<EOF
93 # Autogenerated by casper
99 cat /root/etc/resolv.conf >> /root/var/log/netboot.config