2 # Filename: grml-network
3 # Purpose: configuration script for network
4 # Authors: Michael Prokop <mika@grml.org>, Marcel Wichern 2006, Klaus Knopper 2002, Niall Walsh + Stefan Lippers-Hollmann 2004-2007
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
8 # Changes have been merged from Kanotix's and Sidux's netcardconfig:
9 # http://kanotix.com/files/debian/pool/main/n/netcardconfig-kanotix/
10 # http://svn.berlios.de/wsvn/fullstory/configure-networkcard/trunk/
11 ################################################################################
13 PATH="/bin:/sbin:/usr/bin:/usr/sbin"
15 export PATH LANGUAGE LANG
17 . /etc/grml/script-functions
27 # This function produces the IWOURLINE for interfaces
30 if [ -n "$NWID" ]; then
31 IWOURLINE="$IWOURLINE wireless-nwid $NWID\n"
34 if [ -n "$MODE" ]; then
35 IWOURLINE="$IWOURLINE wireless-mode $MODE\n"
38 if [ -n "$CHANNEL" ]; then
39 IWOURLINE="$IWOURLINE wireless-channel $CHANNEL\n"
42 if [ -n "$FREQ" ]; then
43 IWOURLINE="$IWOURLINE wireless-freq $FREQ\n"
46 if [ -n "$KEY" ]; then
47 if [ "$PUBKEY" -eq 1 ]; then
48 # Store the key in interfaces in wireless-key
49 IWOURLINE="$IWOURLINE wireless-key $KEY\n"
51 # Store the key in /etc/network/wep.$DV which is root readable only
52 # Use pre-up in interfaces to read and set it
53 echo "$KEY" > /etc/network/wep.$DV && chmod 600 /etc/network/wep.$DV && IWOURLINE="$IWOURLINE pre-up KEY=\$(cat /etc/network/wep.$DV) && iwconfig $DV key \$KEY\n"
57 [ -d /sys/module/rt2??0/ ] && IWPREUPLINE="$IWPREUPLINE pre-up /sbin/ifconfig $DV up\n"
59 if [ -n "$IWCONFIG" ]; then
60 IWPREUPLINE="$IWPREUPLINE iwconfig $IWCONFIG\n"
63 if [ -n "$IWSPY" ]; then
64 IWPREUPLINE="$IWPREUPLINE iwspy $IWSPY\n"
67 if [ -n "$IWPRIV" ]; then
68 IWPREUPLINE="$IWPREUPLINE iwpriv $IWPRIV\n"
71 # execute ESSID last, but make sure that it is written as first option
72 if [ -n "$ESSID" ]; then
73 IWOURLINE="$IWOURLINE wireless-essid $ESSID\n"
76 if [ "$WPAON" -gt 0 ]; then
77 IWOURLINE="$IWOURLINE wpa-ssid $ESSID\n wpa-psk $WPASECRET\n"
80 IWOURLINE="$IWOURLINE $IWPREUPLINE"
81 #echo "DEBUG: for interfaces $IWOURLINE"
84 generate_udev_entry() {
86 mkdir -p /etc/udev/scripts
87 echo "# Auto generated script from netcardconfig on $(date)
88 # Executing this script generates an entry in /etc/udev/rules.d/z25_persistent-net.rules
89 # for you, please check z25_persistent-net.rules for existing entries before
90 # running this script (once more)." > /etc/udev/scripts/netcardconfig
91 for interface in `ifconfig | awk '/^[a-z]/ &&!/^lo/{ print $1} '` ; do
92 echo -n "INTERFACE=$interface /lib/udev/write_net_rules " >> /etc/udev/scripts/netcardconfig && \
93 if which udevadm >/dev/null 2>&1; then
94 udevadm info -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
96 udevinfo -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
99 # send errors to /dev/null as well because the sed line inside the /lib/udev/write_net_rules
100 # script outputs a sed warning which might unsettle users
101 chmod +x /etc/udev/scripts/netcardconfig && /etc/udev/scripts/netcardconfig 1>/dev/null 2>&1
104 disable_config_dhcp() {
105 if grep -q CONFIG_DHCP /etc/grml/autoconfig ; then
106 sed -i "s|^CONFIG_DHCP.*|CONFIG_DHCP='no'|" /etc/grml/autoconfig
117 for PART in $DEVICE; do
118 if [ $PARTCOUNT -eq 0 ]; then
121 echo $PART | grep -q A::1 && isauto=1
122 echo $PART | grep -q F::1 && isfirewire=1
123 echo $PART | grep -q W::1 && iswireless=1
124 [ -z "$driver" ] && driver=$(echo $PART|awk 'BEGIN {FS="::"} /^D:/{print $2}')
125 [ -z "$mac" ] && mac=$(echo $PART|awk 'BEGIN {FS="::"} /^M:/{print $2}')
133 [ $isfirewire -gt 0 ] && MY_DEVICE_NAME="$NET_DEVICE_NAME_FW"
134 [ -z "$MY_DEVICE_NAME" -a $iswireless -gt 0 ] && MY_DEVICE_NAME="$NET_DEVICE_NAME_W"
135 [ -z "$MY_DEVICE_NAME" ] && MY_DEVICE_NAME="$NET_DEVICE_NAME"
136 MY_DEVICE_NAME="$DEVICENAME $MY_DEVICE_NAME $mac $driver"
137 [ $isauto -gt 0 ] && MY_DEVICE_NAME="$MY_DEVICE_NAME $NET_DEVICE_NAME_AUTO"
138 MY_DEVICE_NAME=$(echo $MY_DEVICE_NAME | sed 's/\ /__/g')
142 if ! egrep -e "^auto[ ]+.*$DV" /etc/network/interfaces >/dev/null; then
143 awk '{if(/^auto/){if(done==0){print $0 " '"$DV"'";done=1}else{print}}else{print}}END{if(done==0){print "auto '$DV'"}}' "/etc/network/interfaces" > "$TMP"
144 cat "$TMP" > /etc/network/interfaces
149 if egrep -e "^auto[ ]+.*$DV" /etc/network/interfaces >/dev/null; then
150 perl -pi -e 's/^(auto.*)'$DV'(.*)$/$1$2/;' /etc/network/interfaces
157 iwlist $DV scanning | grep "ESSID\|Quality" | sed -e "s/^.*ESSID:\"\|\"$//g" | tac > "$TMP"
160 # don't show up empty and hidden (containing "\x00") ESSIDs
161 echo $line | grep -q \\x00 && continue
162 [ -z "$line" ] && continue
170 [ ! -r /etc/network/interfaces ] && touch /etc/network/interfaces
171 DEVICE=${NETDEVICES[$DV]}
177 WLDEVICE="$(LANG=C LC_MESSAGEWS=C iwconfig $DV 2>/dev/null | awk '/802\.11|READY|ESSID/{print $1}')"
178 WLDEVICECOUNT="$(LANG=C LC_MESSAGEWS=C iwconfig $DV 2>/dev/null | wc -l)"
179 if [ $iswireless -gt 0 ] && $DIALOG --yesno "$MESSAGE13" 8 45; then
194 if [ -f /etc/network/interfaces ]; then
195 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
196 /essid/{if(found){for(i=NF;i>=2;i--)essid=$i "~" essid}}
197 /nwid/{if(found){nwid=$NF}}
198 /mode/{if(found){mode=$NF}}
199 /channel/{if(found){channel=$NF}}
200 /freq/{if(found){freq=$NF}}
201 /sens/{if(found){sens=$NF}}
202 /rate/{if(found){rate=$NF}}
203 /rts/{if(found){rts=$NF}}
204 /frag/{if(found){frag=$NF}}
205 /iwconfig/{if(!/KEY/){if(found){iwconfig=$NF}}}
206 /iwspy/{if(found){iwspy=$NF}}
207 /iwpriv/{if(found){iwpriv=$NF}}
208 /wireless[-_]key/{if(found){gsub(/^\W*wireless[-_]key\W*/,"");key=$0}}
210 if (!(length(essid))){essid="~~~"}
211 if (!(length(nwid))){nwid="~~~"}
212 if (!(length(mode))){mode="~~~"}
213 if (!(length(channel))){channel="~~~"}
214 if (!(length(freq))){freq="~~~"}
215 if (!(length(sens))){sens="~~~"}
216 if (!(length(rate))){rate="~~~"}
217 if (!(length(rts))){rts="~~~"}
218 if (!(length(frag))){frag="~~~"}
219 if (!(length(iwconfig))){iwconfig="~~~"}
220 if (!(length(iwspy))){iwspy="~~~"}
221 if (!(length(iwpriv))){iwpriv="~~~"}
222 if (!(length(key))){key="~~~"}
223 print essid" "nwid" "mode" "channel" "freq" "sens" "rate" "rts" "frag" "iwconfig" "iwspy" "iwpriv" "key
224 }' /etc/network/interfaces >"$TMP"
226 read ESSID NWID MODE CHANNEL FREQ SENS RATE RTS FRAG IWCONFIG IWSPY IWPRIV KEY<"$TMP"
228 [ "$ESSID" = "~~~" ] && ESSID=""
229 [ "$NWID" = "~~~" ] && NWID=""
230 [ "$MODE" = "~~~" ] && MODE=""
231 [ "$CHANNEL" = "~~~" ] && CHANNEL=""
232 [ "$FREQ" = "~~~" ] && FREQ=""
233 [ "$SENS" = "~~~" ] && SENS=""
234 [ "$RATE" = "~~~" ] && RATE=""
235 [ "$RTS" = "~~~" ] && RTS=""
236 [ "$FRAG" = "~~~" ] && FRAG=""
237 [ "$IWCONFIG" = "~~~" ] && IWCONFIG=""
238 [ "$IWSPY" = "~~~" ] && IWSPY=""
239 [ "$IWPRIV" = "~~~" ] && IWPRIV=""
240 [ "$KEY" = "~~~" ] && KEY=""
242 ESSID=$(echo $ESSID | tr "~" " " | sed 's/ *$//')
244 if [ -z "$KEY" ]; then
245 KEY=$(cat /etc/network/wep.$DV 2>/dev/null)
247 if [ -z "$KEY" ]; then
256 #echo "DEBUG:E:$ESSID N:$NWID M:$MODE C:$CHANNEL F:$FREQ S:$SENS R:$RATE K:$KEY R:$RTS F:$FRAG I:$IWCONFIG I:$IWSPY I:$IWPRIV"
260 # ask to scan or manually set wireless network
261 if $DIALOG --yesno "$MESSAGEWSCAN1" 8 45 ; then
264 while [ $RESCAN -eq 1 ]
267 $DIALOG --extra-button --extra-label "Rescan" --menu "$MESSAGEWSCAN2" 20 70 15 "${WARRAY[@] }" 2>"$TMP"
280 read ESSID <"$TMP" ; rm -f "$TMP"
281 [ -z "$MODE" ] && MODE="Managed"
285 $DIALOG --inputbox "$MESSAGEW4 $DEVICENAME $MESSAGEW5" 15 50 "$ESSID" 2>"$TMP" || bailout 1
286 read ESSID <"$TMP" ; rm -f "$TMP"
287 [ -z "$ESSID" ] && ESSID="any"
289 $DIALOG --inputbox "$MESSAGEW6 $DEVICENAME $MESSAGEW7" 15 50 "$NWID" 2>"$TMP" || bailout 1
290 read NWID <"$TMP" ; rm -f "$TMP"
292 $DIALOG --inputbox "$MESSAGEW8 $DEVICENAME $MESSAGEW9" 15 50 "$MODE" 2>"$TMP" || bailout 1
293 read MODE <"$TMP" ; rm -f "$TMP"
294 [ -z "$MODE" ] && MODE="Managed"
296 $DIALOG --inputbox "$MESSAGEW10 $DEVICENAME $MESSAGEW11" 15 50 "$CHANNEL" 2>"$TMP" || bailout 1
297 read CHANNEL <"$TMP" ; rm -f "$TMP"
299 if [ -z "$CHANNEL" ]; then
300 $DIALOG --inputbox "$MESSAGEW12 $DEVICENAME $MESSAGEW13" 15 50 "$FREQ" 2>"$TMP" || bailout 1
301 read FREQ <"$TMP" ; rm -f "$TMP"
313 ipw2200|ipw2100|ipw3945)
324 if [ -z "$WPA_DEV" ]; then
325 if [ -d /proc/net/ndiswrapper/$DV ]; then
327 elif [ -d /proc/net/hostap/$DV ]; then
329 elif [ $WLDEVICECOUNT -eq 1 ]; then
330 if [ -e /proc/driver/atmel ]; then
338 if [ -n "$WPA_DEV" ]; then
339 if $DIALOG --yesno "$MESSAGEW22" 15 50; then
342 # bssid 00:11:22:33:44:55
343 # priority [0]|Integer
344 # proto [WPA RSN] WPA|RSN
345 # key_mgmt [WPA-PSK WPA-EAP]|NONE|WPA-PSK|WPA-EAP|IEEE8021X
346 # pairwise [CCMP TKIP]|CCMP|TKIP|NONE
347 # group [CCMP TKIP WEP105 WEP40]|CCMP|TKIP|WEP105|WEP40
348 # eapol_flags [3]|1|2
364 if (gsub(/^\W*wpa-psk\W*/,"")){
371 ' /etc/network/interfaces)
372 FIRST_RUN=0 # show the wpasecret input box at least once
373 while ( [ -z "$WPASECRET" ] || [ "$FIRST_RUN" ] ) ; do
374 $DIALOG --inputbox "$MESSAGEW23 $ESSID" 15 50 "$WPASECRET" 2>"$TMP" || bailout 1
375 read WPASECRET <"$TMP"
376 if [ -z "$WPASECRET" ] ; then
377 $DIALOG --msgbox "Sorry, empty password not allowed, please retry." 0 0 || bailout 1
396 # No need for a wep key if we are using wpa
397 if [ ! $WPAON -eq 1 ]; then
398 $DIALOG --inputbox "$MESSAGEW14 $DEVICENAME $MESSAGEW15" 15 50 "$KEY" 2>"$TMP" || bailout 1
399 read KEY <"$TMP" ; rm -f "$TMP"
401 if [ -n "$KEY" -a "$PUBKEY" -eq 0 ]; then
402 if ! $DIALOG --yesno "$MESSAGEW25 $DEVICENAME $MESSAGEW26" 15 50; then
408 $DIALOG --inputbox "$MESSAGEW16 $DEVICENAME $MESSAGEW17" 15 50 "$IWCONFIG" 2>"$TMP" || bailout 1
409 read IWCONFIG <"$TMP" ; rm -f "$TMP"
411 $DIALOG --inputbox "$MESSAGEW18 $DEVICENAME $MESSAGEW19" 15 50 "$IWSPY" 2>"$TMP" || bailout 1
412 read IWSPY <"$TMP" ; rm -f "$TMP"
414 $DIALOG --inputbox "$MESSAGEW20 $DEVICENAME $MESSAGEW21" 15 50 "$IWPRIV" 2>"$TMP" || bailout 1
415 read IWPRIV <"$TMP" ; rm -f "$TMP"
420 if $DIALOG --yesno "$MESSAGE2" 8 45; then
421 if [ -w /etc/network/interfaces ]; then
423 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
424 /^\W$/{if(blank==0){lastblank=1}else{lastblank=0}{blank=1}}
425 /\w/{blank=0;lastblank=0}
426 {if(!(found+lastblank)){print}}
427 END{print "iface '"$DV"' inet dhcp"}' \
428 /etc/network/interfaces >"$TMP"
429 echo -e "$IWOURLINE" >> $TMP
430 #echo -e "\n\n" >> $TMP
431 cat "$TMP" >/etc/network/interfaces
433 # Add an "auto" entry
437 if [ -f /etc/network/interfaces ]; then
438 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
439 /address/{if(found){address=$NF}}
440 /netmask/{if(found){netmask=$NF}}
441 /broadcast/{if(found){broadcast=$NF}}
442 /gateway/{if(found){gateway=$NF}}
443 /dns-nameservers/{if(found){dnsnameservers=$NF}}
444 END{print address" "netmask" "broadcast" "gateway" "dnsnameservers}' /etc/network/interfaces >"$TMP"
445 read IP NM BC DG NS <"$TMP"
449 $DIALOG --inputbox "$MESSAGE6 $DV" 10 45 "${IP:-192.168.0.1}" 2>"$TMP" || bailout 1
450 read IP <"$TMP" ; rm -f "$TMP"
452 $DIALOG --inputbox "$MESSAGE7 $DV" 10 45 "${NM:-255.255.255.0}" 2>"$TMP" || bailout 1
453 read NM <"$TMP" ; rm -f "$TMP"
455 $DIALOG --inputbox "$MESSAGE8 $DV" 10 45 "${BC:-${IP%.*}.255}" 2>"$TMP" || bailout 1
456 read BC <"$TMP" ; rm -f "$TMP"
458 $DIALOG --inputbox "$MESSAGE9" 10 45 "${DG:-${IP%.*}.1}" 2>"$TMP"
459 read DG <"$TMP" ; rm -f "$TMP"
461 if [ -f "/etc/resolv.conf" ]; then
462 NS="$(awk '/^nameserver/{printf "%s ",$2}' /etc/resolv.conf)"
465 $DIALOG --inputbox "$MESSAGE10" 10 45 "${NS:-$DG}" 2>"$TMP"
466 read NS <"$TMP" ; rm -f "$TMP"
468 if [ -w /etc/network/interfaces ]; then
469 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
471 END{print "\niface '"$DV"' inet static\n\taddress '"$IP"'\n\tnetmask '"$NM"'\n\tnetwork '"${IP%.*}.0"'";if("'"$BC"'"!=""){print "\tbroadcast '"$BC"'"};if("'"$DG"'"!=""){print "\tgateway '"$DG"'"};if("'"$NS"'"!=""){print "\tdns-nameservers '"$NS"'"};if("'"$IWOURLINE"'"!=""){print "'"$IWOURLINE"'"};print "\n"}' \
472 /etc/network/interfaces >"$TMP"
474 cat "$TMP" >/etc/network/interfaces
477 # Add an "auto" entry
487 NET_DEVICE_NAME="Network_device"
488 NET_DEVICE_NAME_W="Wireless_device"
489 NET_DEVICE_NAME_FW="Firewire_device"
490 NET_DEVICE_NAME_AUTO="Auto"
491 MESSAGE0="No supported network cards found."
492 MESSAGE1="Please select network device"
493 MESSAGE2="Use DHCP broadcast?"
494 MESSAGE3="Sending DHCP broadcast from device"
496 MESSAGE5="Hit return to exit."
497 MESSAGE6="Please enter IP Address for"
498 MESSAGE7="Please enter Network Mask for"
499 MESSAGE8="Please enter Broadcast Address for"
500 MESSAGE9="Please enter Default Gateway"
501 MESSAGE10="Please enter Nameserver(s)"
502 MESSAGE11="Setting Nameserver in /etc/resolv.conf to"
503 MESSAGE12="Adding Nameserver to /etc/resolv.conf:"
504 MESSAGE13="Setup wireless options?"
505 MESSAGE14="Failed to bring up the interface, would you like to reconfigure it?"
506 MESSAGE15="Interface enabled, do you want it auto enabled at boot?"
507 MESSAGEW0="No wireless network card found."
508 MESSAGEW1="Configuration of wireless parameters for"
509 MESSAGEW3="Please configure IP parameters of the interface first"
510 MESSAGEW4="Enter the ESSID for"
511 MESSAGEW5="\n\n\n(empty for 'any', not recommended !)\n"
512 MESSAGEW6="Enter the NWID (cell identifier)\nfor"
513 MESSAGEW7=", if needed\n\n\n"
514 MESSAGEW8="Enter the mode for"
515 MESSAGEW9="\n\n(Managed(=default), Ad-Hoc, Master,\nRepeater, Secondary, auto)\n"
516 MESSAGEW10="Enter channel number for"
517 MESSAGEW11="\n\n(0 bis 16, empty for auto or if you want to\n enter the frequency next)\n"
518 MESSAGEW12="Enter the frequency for"
519 MESSAGEW13="\n\n(e.g 2.412G, empty for auto)"
520 MESSAGEW14="Enter the encryption key\nfor"
521 MESSAGEW15="\n\n(empty for cleartext, not recommended !!)"
522 MESSAGEW16="Enter additional parameters for\n'iwconfig"
523 MESSAGEW17="' if needed, e.g.\n\n\nsens -80 rts 512 frag 512 rate 5.5M"
524 MESSAGEW18="Enter additional parameters for\n'iwspy"
525 MESSAGEW19="' if needed\n\n\n"
526 MESSAGEW20="Enter additional parameters for\n'iwpriv"
527 MESSAGEW21="' if needed\n\n\n"
528 MESSAGEW22="Enable WPA support?"
529 MESSAGEW23="Enter the WPA passphrase (passphrase must be 8..63 characters) for"
530 MESSAGEW25="Would you like to store your wep key in it's own private file ("
531 MESSAGEW26=")? If you say no, your wep key will be stored in /etc/network/interfaces and will be readable by any account on your system. You may want to 'chmod 600 /etc/network/interfaces' if you answer no to this question"
532 MESSAGEWSCAN1="Scan for available wireless networks?"
533 MESSAGEWSCAN2="Please choose a wireless network from below:"
536 if [ -r /proc/net/dev ] ; then
537 LAN=$(tail -n +3 /proc/net/dev | awk -F: '{print $1}'| sed "s/\s*//" | grep -v -e ^lo -e ^vmnet | sort)
542 if [ -z "$WLAN" ] ; then
543 WLAN_OLD=$(tail -n +3 /proc/net/wireless 2>/dev/null|awk -F: '{print $1}')
544 # /proc/net/wireless does not work e.g. with iwl3945 on kernel 2.6.33 anymore
545 WLAN_NEW=$(for i in /sys/class/net/* ; do ( [ -d $i/wireless ] || [ -d $i/phy80211 ] ) && basename $i ; done)
548 iwconfig $DEV 2>/dev/null 1>&2 && WLAN_IWCONFIG+=($DEV)
550 WLAN=$(echo $WLAN_OLD $WLAN_NEW ${WLAN_IWCONFIG[@]} | tr ' ' '\n' | sort -u)
553 unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES WLAN_IWCONFIG
555 while read dev mac; do
556 #echo "Making NETDEVICES $NETDEVICESCOUNT $dev"
557 iswlan=$(echo $dev $WLAN|tr ' ' '\n'|sort|uniq -d)
559 grep auto /etc/network/interfaces | grep -q $dev && isauto="1"
560 driver=$(ethtool -i $dev 2>/dev/null|awk '/^driver:/{print $2}')
561 if [ "$driver" ]; then
562 if [ "$iswlan" ]; then
563 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac D::$driver W::1 F::0"
565 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac D::$driver W::0 F::0"
568 if [ "$iswlan" ]; then
569 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac W::1 F::0"
571 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac W::0 F::0"
574 #echo "Made to ${NETDEVICES[$NETDEVICESCOUNT]}"
575 ((NETDEVICESCOUNT++))
576 done < <(ifconfig -a|grep Ethernet|grep -v ^vmnet|awk '! /^\s/{print $1" "$5}')
578 if [ "$(ethtool -i $dev 2>/dev/null|awk '/^bus-info:/{print $2}')" == "ieee1394" ]; then
580 grep auto /etc/network/interfaces | grep -q $dev && isauto="1"
581 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto D::$(ethtool -i $dev 2>/dev/null|awk '/^driver:/{print $2}') W::0 F::1"
582 ((NETDEVICESCOUNT++))
586 #NETDEVICES="$(cat /proc/net/dev | awk -F: '/eth.:|lan.:|tr.:|wlan.:|ath.:|ra.:/{print $1}')"
588 if [ -z "$NETDEVICES" ]; then
589 $DIALOG --msgbox "$MESSAGE0" 15 45
593 count="$NETDEVICESCOUNT"
595 if [ "$count" -gt 1 ]; then
598 while [ $mycount -lt $count ]; do
599 DEVICE=${NETDEVICES[$mycount]}
600 #echo "$mycount is $DEVICE"
602 #echo "name: $DEVICENAME auto: $isauto fw: $isfirewire mac: $mac driver: $driver"
604 DEVICELIST="$DEVICELIST $mycount $MY_DEVICE_NAME"
611 EXITMENU="$EXITKEY Exit"
613 # main program loop until they bailout
615 # first get the device
616 if [ "$count" -gt 1 ]; then
618 $DIALOG --menu "$MESSAGE1" 18 60 12 $DEVICELIST $EXITMENU 2>"$TMP" || bailout
619 read DV <"$TMP" ; rm -f "$TMP"
620 [ "$DV" = "$EXITKEY" ] && bailout
624 # they have asked to stop configuring the interface so exit
625 [ -z "$IFACEDONE" ] || bailout
629 while [ -n "$DV" -a -z "$IFACEDONE" ]; do
632 $DIALOG --yesno "$MESSAGE14" 15 50 || IFACEDONE="DONE"
634 if $DIALOG --yesno "$MESSAGE15" 12 50 ; then
636 # get persistent interface names across reboots
638 # make sure we don't run the dhcp stuff when using /etc/network/interfaces
648 ## END OF FILE #################################################################