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
39 if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then
40 parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
41 for ifline in ${parsed}; do
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 ',')"
46 cat >> "$IFFILE" <<EOF
48 iface ${ifname} inet static
56 if [ -z "${NETBOOT}" ]; then
57 # default, dhcp assigned
60 # make sure that the preconfigured interface would not get reassigned by dhcp
61 # on startup by ifup script - otherwise our root fs might be disconnected!
65 # iterate the physical interfaces and add them to the interfaces list
66 for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do
67 [ -e $interface ] || continue
68 i="$(basename $interface)"
69 cat >> "$IFFILE" <<EOF
71 iface $i inet ${method}
75 if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ] ; then
76 # create a resolv.conf if it is not present
77 cp /netboot.config /root/var/log/netboot.config
78 rc_search=$(cat netboot.config | awk '/domain/{print $3}')
79 rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
80 rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
81 rc_server0="nameserver ${rc_server0}"
82 if [ "${rc_server1}" = "0.0.0.0" ]; then
85 rc_server1="nameserver ${rc_server1}"
87 cat > /root/etc/resolv.conf <<EOF
89 # Autogenerated by casper
95 cat /root/etc/resolv.conf >> /root/var/log/netboot.config