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
38 if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then
39 parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
40 for ifline in ${parsed}; do
41 ifname="$(echo ${ifline} | cut -f1 -d ',')"
42 ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
43 ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
44 ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
45 cat >> "$IFFILE" <<EOF
47 iface ${ifname} inet static
55 if [ -z "${NETBOOT}" ]; then
56 # default, dhcp assigned
59 # make sure that the preconfigured interface would not get reassigned by dhcp
60 # on startup by ifup script - otherwise our root fs might be disconnected!
64 # iterate the physical interfaces and add them to the interfaces list
65 for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do
66 [ -e $interface ] || continue
67 i="$(basename $interface)"
68 cat >> "$IFFILE" <<EOF
70 iface ${i} inet ${method}
74 if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ] ; then
75 # create a resolv.conf if it is not present
76 cp /netboot.config /root/var/log/netboot.config
77 rc_search=$(cat netboot.config | awk '/domain/{print $3}')
78 rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
79 rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
80 rc_server0="nameserver ${rc_server0}"
81 if [ "${rc_server1}" = "0.0.0.0" ]; then
84 rc_server1="nameserver ${rc_server1}"
86 cat > /root/etc/resolv.conf <<EOF
88 # Autogenerated by casper
94 cat /root/etc/resolv.conf >> /root/var/log/netboot.config