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 for mod in /sys/module/rt2??0/ ; do
58 if [ -d "$mod" ]; then
59 IWPREUPLINE="$IWPREUPLINE pre-up /sbin/ip link set $DV up\n"
64 if [ -n "$IWCONFIG" ]; then
65 IWPREUPLINE="$IWPREUPLINE iwconfig $IWCONFIG\n"
68 if [ -n "$IWSPY" ]; then
69 IWPREUPLINE="$IWPREUPLINE iwspy $IWSPY\n"
72 if [ -n "$IWPRIV" ]; then
73 IWPREUPLINE="$IWPREUPLINE iwpriv $IWPRIV\n"
76 # execute ESSID last, but make sure that it is written as first option
77 if [ -n "$ESSID" ]; then
78 IWOURLINE="$IWOURLINE wireless-essid $ESSID\n"
81 if [ "$WPAON" -gt 0 ]; then
82 IWOURLINE="$IWOURLINE wpa-ssid $ESSID\n wpa-psk $WPASECRET\n"
85 IWOURLINE="$IWOURLINE $IWPREUPLINE"
86 #echo "DEBUG: for interfaces $IWOURLINE"
89 generate_udev_entry() {
91 mkdir -p /etc/udev/scripts
92 echo "# Auto generated script from netcardconfig on $(date)
93 # Executing this script generates an entry in /etc/udev/rules.d/z25_persistent-net.rules
94 # for you, please check z25_persistent-net.rules for existing entries before
95 # running this script (once more)." > /etc/udev/scripts/netcardconfig
96 for interface in $(ip -oneline link | awk '!/ lo: / {print $2}' | sed 's/:$//; s/@.*//') ; do
97 echo -n "INTERFACE=$interface /lib/udev/write_net_rules " >> /etc/udev/scripts/netcardconfig && \
98 if which udevadm >/dev/null 2>&1; then
99 udevadm info -a -p "/sys/class/net/$interface" | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
101 udevinfo -a -p "/sys/class/net/$interface" | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
104 # send errors to /dev/null as well because the sed line inside the /lib/udev/write_net_rules
105 # script outputs a sed warning which might unsettle users
106 chmod +x /etc/udev/scripts/netcardconfig && /etc/udev/scripts/netcardconfig 1>/dev/null 2>&1
109 disable_config_dhcp() {
110 if grep -q CONFIG_DHCP /etc/grml/autoconfig ; then
111 sed -i "s|^CONFIG_DHCP.*|CONFIG_DHCP='no'|" /etc/grml/autoconfig
122 for PART in $DEVICE; do
123 if [ $PARTCOUNT -eq 0 ]; then
126 echo "$PART" | grep -q A::1 && isauto=1
127 echo "$PART" | grep -q F::1 && isfirewire=1
128 echo "$PART" | grep -q W::1 && iswireless=1
129 [ -z "$driver" ] && driver=$(echo "$PART"|awk 'BEGIN {FS="::"} /^D:/{print $2}')
130 [ -z "$mac" ] && mac=$(echo "$PART"|awk 'BEGIN {FS="::"} /^M:/{print $2}')
138 [ $isfirewire -gt 0 ] && MY_DEVICE_NAME="$NET_DEVICE_NAME_FW"
139 [ -z "$MY_DEVICE_NAME" ] && [ $iswireless -gt 0 ] && MY_DEVICE_NAME="$NET_DEVICE_NAME_W"
140 [ -z "$MY_DEVICE_NAME" ] && MY_DEVICE_NAME="$NET_DEVICE_NAME"
141 MY_DEVICE_NAME="$DEVICENAME $MY_DEVICE_NAME $mac $driver"
142 [ $isauto -gt 0 ] && MY_DEVICE_NAME="$MY_DEVICE_NAME $NET_DEVICE_NAME_AUTO"
143 MY_DEVICE_NAME="${MY_DEVICE_NAME// /__}"
147 if ! grep -E "^auto .*$DV" /etc/network/interfaces >/dev/null; then
148 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"
149 cat "$TMP" > /etc/network/interfaces
154 if grep -e "^auto .*$DV" /etc/network/interfaces >/dev/null; then
155 perl -pi -e 's/^(auto.*)'"$DV"'(.*)$/$1$2/;' /etc/network/interfaces
162 iwlist "$DV" scanning | grep "ESSID\|Quality" | sed -e "s/^.*ESSID:\"\|\"$//g" | tac > "$TMP"
172 [ ! -r /etc/network/interfaces ] && touch /etc/network/interfaces
173 DEVICE=${NETDEVICES[$DV]}
179 WLDEVICECOUNT="$(LANG=C LC_MESSAGEWS=C iwconfig "$DV" 2>/dev/null | wc -l)"
180 if [ $iswireless -gt 0 ] && $DIALOG --yesno "$MESSAGE13" 8 45; then
195 if [ -f /etc/network/interfaces ]; then
196 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
197 /essid/{if(found){for(i=NF;i>=2;i--)essid=$i "~" essid}}
198 /nwid/{if(found){nwid=$NF}}
199 /mode/{if(found){mode=$NF}}
200 /channel/{if(found){channel=$NF}}
201 /freq/{if(found){freq=$NF}}
202 /sens/{if(found){sens=$NF}}
203 /rate/{if(found){rate=$NF}}
204 /rts/{if(found){rts=$NF}}
205 /frag/{if(found){frag=$NF}}
206 /iwconfig/{if(!/KEY/){if(found){iwconfig=$NF}}}
207 /iwspy/{if(found){iwspy=$NF}}
208 /iwpriv/{if(found){iwpriv=$NF}}
209 /wireless[-_]key/{if(found){gsub(/^\W*wireless[-_]key\W*/,"");key=$0}}
211 if (!(length(essid))){essid="~~~"}
212 if (!(length(nwid))){nwid="~~~"}
213 if (!(length(mode))){mode="~~~"}
214 if (!(length(channel))){channel="~~~"}
215 if (!(length(freq))){freq="~~~"}
216 if (!(length(sens))){sens="~~~"}
217 if (!(length(rate))){rate="~~~"}
218 if (!(length(rts))){rts="~~~"}
219 if (!(length(frag))){frag="~~~"}
220 if (!(length(iwconfig))){iwconfig="~~~"}
221 if (!(length(iwspy))){iwspy="~~~"}
222 if (!(length(iwpriv))){iwpriv="~~~"}
223 if (!(length(key))){key="~~~"}
224 print essid" "nwid" "mode" "channel" "freq" "sens" "rate" "rts" "frag" "iwconfig" "iwspy" "iwpriv" "key
225 }' /etc/network/interfaces >"$TMP"
227 read -r ESSID NWID MODE CHANNEL FREQ SENS RATE RTS FRAG IWCONFIG IWSPY IWPRIV KEY<"$TMP"
229 [[ "$ESSID" =~ ^~~~$ ]] && ESSID=""
230 [[ "$NWID" =~ ^~~~$ ]] && NWID=""
231 [[ "$MODE" =~ ^~~~$ ]] && MODE=""
232 [[ "$CHANNEL" =~ ^~~~$ ]] && CHANNEL=""
233 [[ "$FREQ" =~ ^~~~$ ]] && FREQ=""
234 [[ "$SENS" =~ ^~~~$ ]] && SENS=""
235 [[ "$RATE" =~ ^~~~$ ]] && RATE=""
236 [[ "$RTS" =~ ^~~~$ ]] && RTS=""
237 [[ "$FRAG" =~ ^~~~$ ]] && FRAG=""
238 [[ "$IWCONFIG" =~ ^~~~$ ]] && IWCONFIG=""
239 [[ "$IWSPY" =~ ^~~~$ ]] && IWSPY=""
240 [[ "$IWPRIV" =~ ^~~~$ ]] && IWPRIV=""
241 [[ "$KEY" =~ ^~~~$ ]] && KEY=""
243 # shellcheck disable=SC2088
244 ESSID=$(echo $ESSID | tr '~' " " | sed 's/ *$//')
246 if [ -z "$KEY" ]; then
247 KEY=$(cat "/etc/network/wep.$DV" 2>/dev/null)
249 if [ -z "$KEY" ]; then
258 #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"
262 # ask to scan or manually set wireless network
263 if $DIALOG --yesno "$MESSAGEWSCAN1" 8 45 ; then
266 while [ $RESCAN -eq 1 ]
269 $DIALOG --extra-button --extra-label "Rescan" --menu "$MESSAGEWSCAN2" 20 70 15 "${WARRAY[@]}" 2>"$TMP"
282 read -r ESSID <"$TMP" ; rm -f "$TMP"
283 [ -z "$MODE" ] && MODE="Managed"
287 $DIALOG --inputbox "$MESSAGEW4 $DEVICENAME $MESSAGEW5" 15 50 "$ESSID" 2>"$TMP" || bailout 1
288 read -r ESSID <"$TMP" ; rm -f "$TMP"
289 [ -z "$ESSID" ] && ESSID="any"
291 $DIALOG --inputbox "$MESSAGEW6 $DEVICENAME $MESSAGEW7" 15 50 "$NWID" 2>"$TMP" || bailout 1
292 read -r NWID <"$TMP" ; rm -f "$TMP"
294 $DIALOG --inputbox "$MESSAGEW8 $DEVICENAME $MESSAGEW9" 15 50 "$MODE" 2>"$TMP" || bailout 1
295 read -r MODE <"$TMP" ; rm -f "$TMP"
296 [ -z "$MODE" ] && MODE="Managed"
298 $DIALOG --inputbox "$MESSAGEW10 $DEVICENAME $MESSAGEW11" 15 50 "$CHANNEL" 2>"$TMP" || bailout 1
299 read -r CHANNEL <"$TMP" ; rm -f "$TMP"
301 if [ -z "$CHANNEL" ]; then
302 $DIALOG --inputbox "$MESSAGEW12 $DEVICENAME $MESSAGEW13" 15 50 "$FREQ" 2>"$TMP" || bailout 1
303 read -r FREQ <"$TMP" ; rm -f "$TMP"
315 ipw2200|ipw2100|ipw3945)
326 if [ -z "$WPA_DEV" ]; then
327 if [ -d "/proc/net/ndiswrapper/$DV" ]; then
329 elif [ -d "/proc/net/hostap/$DV" ]; then
331 elif [ "$WLDEVICECOUNT" -eq 1 ]; then
332 if [ -e /proc/driver/atmel ]; then
340 if [ -n "$WPA_DEV" ]; then
341 if $DIALOG --yesno "$MESSAGEW22" 15 50; then
344 # bssid 00:11:22:33:44:55
345 # priority [0]|Integer
346 # proto [WPA RSN] WPA|RSN
347 # key_mgmt [WPA-PSK WPA-EAP]|NONE|WPA-PSK|WPA-EAP|IEEE8021X
348 # pairwise [CCMP TKIP]|CCMP|TKIP|NONE
349 # group [CCMP TKIP WEP105 WEP40]|CCMP|TKIP|WEP105|WEP40
350 # eapol_flags [3]|1|2
366 if (gsub(/^\W*wpa-psk\W*/,"")){
373 ' /etc/network/interfaces)
374 FIRST_RUN=0 # show the wpasecret input box at least once
375 while ( [ -z "$WPASECRET" ] || [ "$FIRST_RUN" ] ) ; do
376 $DIALOG --inputbox "$MESSAGEW23 $ESSID" 15 50 "$WPASECRET" 2>"$TMP" || bailout 1
377 read -r WPASECRET <"$TMP"
378 if [ -z "$WPASECRET" ] ; then
379 $DIALOG --msgbox "Sorry, empty password not allowed, please retry." 0 0 || bailout 1
398 # No need for a wep key if we are using wpa
399 if [ ! $WPAON -eq 1 ]; then
400 $DIALOG --inputbox "$MESSAGEW14 $DEVICENAME $MESSAGEW15" 15 50 "$KEY" 2>"$TMP" || bailout 1
401 read -r KEY <"$TMP" ; rm -f "$TMP"
403 if [ -n "$KEY" ] && [ "$PUBKEY" -eq 0 ]; then
404 if ! $DIALOG --yesno "$MESSAGEW25 $DEVICENAME $MESSAGEW26" 15 50; then
410 $DIALOG --inputbox "$MESSAGEW16 $DEVICENAME $MESSAGEW17" 15 50 "$IWCONFIG" 2>"$TMP" || bailout 1
411 read -r IWCONFIG <"$TMP" ; rm -f "$TMP"
413 $DIALOG --inputbox "$MESSAGEW18 $DEVICENAME $MESSAGEW19" 15 50 "$IWSPY" 2>"$TMP" || bailout 1
414 read -r IWSPY <"$TMP" ; rm -f "$TMP"
416 $DIALOG --inputbox "$MESSAGEW20 $DEVICENAME $MESSAGEW21" 15 50 "$IWPRIV" 2>"$TMP" || bailout 1
417 read -r IWPRIV <"$TMP" ; rm -f "$TMP"
422 # Configure VLAN on this interface?
423 if $DIALOG --defaultno --yesno "$MESSAGE16" 8 45; then
424 $DIALOG --inputbox "$MESSAGE17 $DV" 10 45 2>"$TMP" || bailout 1
425 read -r VLAN <"$TMP" ; rm -f "$TMP"
426 if [ -n "$VLAN" ]; then
427 modprobe 8021q # avoid warning that VLAN support isn't present yet
433 if $DIALOG --yesno "$MESSAGE2" 8 45; then
434 if [ -w /etc/network/interfaces ]; then
436 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
437 /^\W$/{if(blank==0){lastblank=1}else{lastblank=0}{blank=1}}
438 /\w/{blank=0;lastblank=0}
439 {if(!(found+lastblank)){print}}
440 END{print "iface '"$DV"' inet dhcp";if("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"}}' \
441 /etc/network/interfaces >"$TMP"
442 echo -e "$IWOURLINE" >> "$TMP"
443 #echo -e "\n\n" >> $TMP
444 cat "$TMP" >/etc/network/interfaces
446 # Add an "auto" entry
450 if [ -f /etc/network/interfaces ]; then
451 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
452 /address/{if(found){address=$NF}}
453 /netmask/{if(found){netmask=$NF}}
454 /broadcast/{if(found){broadcast=$NF}}
455 /gateway/{if(found){gateway=$NF}}
456 /dns-nameservers/{if(found){dnsnameservers=$NF}}
457 END{print address" "netmask" "broadcast" "gateway" "dnsnameservers}' /etc/network/interfaces >"$TMP"
458 read -r IP NM BC DG NS <"$TMP"
462 $DIALOG --inputbox "$MESSAGE6 $DV" 10 45 "${IP:-192.168.0.1}" 2>"$TMP" || bailout 1
463 read -r IP <"$TMP" ; rm -f "$TMP"
465 $DIALOG --inputbox "$MESSAGE7 $DV" 10 45 "${NM:-255.255.255.0}" 2>"$TMP" || bailout 1
466 read -r NM <"$TMP" ; rm -f "$TMP"
468 $DIALOG --inputbox "$MESSAGE8 $DV" 10 45 "${BC:-${IP%.*}.255}" 2>"$TMP" || bailout 1
469 read -r BC <"$TMP" ; rm -f "$TMP"
471 $DIALOG --inputbox "$MESSAGE9" 10 45 "${DG:-${IP%.*}.1}" 2>"$TMP"
472 read -r DG <"$TMP" ; rm -f "$TMP"
474 if [ -f "/etc/resolv.conf" ]; then
475 NS="$(awk '/^nameserver/{printf "%s ",$2}' /etc/resolv.conf)"
478 $DIALOG --inputbox "$MESSAGE10" 10 45 "${NS:-$DG}" 2>"$TMP"
479 read -r NS <"$TMP" ; rm -f "$TMP"
481 if [ -w /etc/network/interfaces ]; then
482 awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
484 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("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"};if("'"$IWOURLINE"'"!=""){print "'"$IWOURLINE"'"};print "\n"}' \
485 /etc/network/interfaces >"$TMP"
487 cat "$TMP" >/etc/network/interfaces
490 # Add an "auto" entry
500 NET_DEVICE_NAME="Network_device"
501 NET_DEVICE_NAME_W="Wireless_device"
502 NET_DEVICE_NAME_FW="Firewire_device"
503 NET_DEVICE_NAME_AUTO="Auto"
504 MESSAGE0="No supported network cards found."
505 MESSAGE1="Please select network device"
506 MESSAGE2="Use DHCP broadcast?"
507 MESSAGE6="Please enter IP Address for"
508 MESSAGE7="Please enter Network Mask for"
509 MESSAGE8="Please enter Broadcast Address for"
510 MESSAGE9="Please enter Default Gateway"
511 MESSAGE10="Please enter Nameserver(s)"
512 MESSAGE13="Setup wireless options?"
513 MESSAGE14="Failed to bring up the interface, would you like to reconfigure it?"
514 MESSAGE15="Interface enabled, do you want it auto enabled at boot?"
515 MESSAGE16="Configure VLAN on this interface?"
516 MESSAGE17="Please enter VLAN id for"
517 MESSAGEW4="Enter the ESSID for"
518 MESSAGEW5="\n\n\n(empty for 'any', not recommended !)\n"
519 MESSAGEW6="Enter the NWID (cell identifier)\nfor"
520 MESSAGEW7=", if needed\n\n\n"
521 MESSAGEW8="Enter the mode for"
522 MESSAGEW9="\n\n(Managed(=default), Ad-Hoc, Master,\nRepeater, Secondary, auto)\n"
523 MESSAGEW10="Enter channel number for"
524 MESSAGEW11="\n\n(0 bis 16, empty for auto or if you want to\n enter the frequency next)\n"
525 MESSAGEW12="Enter the frequency for"
526 MESSAGEW13="\n\n(e.g 2.412G, empty for auto)"
527 MESSAGEW14="Enter the encryption key\nfor"
528 MESSAGEW15="\n\n(empty for cleartext, not recommended !!)"
529 MESSAGEW16="Enter additional parameters for\n'iwconfig"
530 MESSAGEW17="' if needed, e.g.\n\n\nsens -80 rts 512 frag 512 rate 5.5M"
531 MESSAGEW18="Enter additional parameters for\n'iwspy"
532 MESSAGEW19="' if needed\n\n\n"
533 MESSAGEW20="Enter additional parameters for\n'iwpriv"
534 MESSAGEW21="' if needed\n\n\n"
535 MESSAGEW22="Enable WPA support?"
536 MESSAGEW23="Enter the WPA passphrase (passphrase must be 8..63 characters) for"
537 MESSAGEW25="Would you like to store your wep key in it's own private file ("
538 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"
539 MESSAGEWSCAN1="Scan for available wireless networks?"
540 MESSAGEWSCAN2="Please choose a wireless network from below:"
543 if [ -r /proc/net/dev ] ; then
544 LAN=$(tail -n +3 /proc/net/dev | awk -F: '{print $1}'| sed "s/\s*//" | grep -v -e ^lo -e ^vmnet | sort)
549 if [ -z "${WLAN[*]}" ] ; then
550 WLAN_OLD=( $(tail -n +3 /proc/net/wireless 2>/dev/null|awk -F: '{print $1}') )
551 # /proc/net/wireless does not work e.g. with iwl3945 on kernel 2.6.33 anymore
552 WLAN_NEW=( $(for i in /sys/class/net/* ; do ( [ -d "$i/wireless" ] || [ -d "$i/phy80211" ] ) && basename "$i" ; done) )
555 iwconfig $DEV 2>/dev/null 1>&2 && WLAN_IWCONFIG+=($DEV)
557 WLAN=( $(echo "${WLAN_OLD[@]}" "${WLAN_NEW[@]}" "${WLAN_IWCONFIG[@]}" | tr ' ' '\n' | sort -u) )
560 unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES WLAN_IWCONFIG
562 while read -r dev mac; do
563 #echo "Making NETDEVICES $NETDEVICESCOUNT $dev"
564 iswlan=$(echo "$dev" "${WLAN[@]}"|tr ' ' '\n'|sort|uniq -d)
566 grep auto /etc/network/interfaces | grep -q "$dev" && isauto="1"
567 driver=$(ethtool -i "$dev" 2>/dev/null|awk '/^driver:/{print $2}')
568 if [ "$driver" ]; then
569 if [ "$iswlan" ]; then
570 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac D::$driver W::1 F::0"
572 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac D::$driver W::0 F::0"
575 if [ "$iswlan" ]; then
576 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac W::1 F::0"
578 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto M::$mac W::0 F::0"
581 #echo "Made to ${NETDEVICES[$NETDEVICESCOUNT]}"
582 ((NETDEVICESCOUNT++))
583 done < <(ip link show | awk ' !/^\s/{sub(/:/,"",$2);IFACE=$2} /link.ether/{if (IFACE !~/^vmnet/) print IFACE" "$2}')
585 if [ "$(ethtool -i $dev 2>/dev/null|awk '/^bus-info:/{print $2}')" == "ieee1394" ]; then
587 grep auto /etc/network/interfaces | grep -q $dev && isauto="1"
588 NETDEVICES[$NETDEVICESCOUNT]="$dev A::$isauto D::$(ethtool -i $dev 2>/dev/null|awk '/^driver:/{print $2}') W::0 F::1"
589 ((NETDEVICESCOUNT++))
593 #NETDEVICES="$(cat /proc/net/dev | awk -F: '/eth.:|lan.:|tr.:|wlan.:|ath.:|ra.:/{print $1}')"
595 if [ -z "${NETDEVICES[*]}" ]; then
596 $DIALOG --msgbox "$MESSAGE0" 15 45
600 count="$NETDEVICESCOUNT"
602 if [ "$count" -gt 1 ]; then
605 while [ $mycount -lt $count ]; do
606 DEVICE=${NETDEVICES[$mycount]}
607 #echo "$mycount is $DEVICE"
609 #echo "name: $DEVICENAME auto: $isauto fw: $isfirewire mac: $mac driver: $driver"
611 DEVICELIST=( "${DEVICELIST[@]}" "$mycount" "$MY_DEVICE_NAME" )
618 EXITMENU=( $EXITKEY Exit )
620 # main program loop until they bailout
622 # first get the device
623 if [ "$count" -gt 1 ]; then
625 $DIALOG --menu "$MESSAGE1" 18 60 12 "${DEVICELIST[@]}" "${EXITMENU[@]}" 2>"$TMP" || bailout
626 read -r DV <"$TMP" ; rm -f "$TMP"
627 [ "$DV" = "$EXITKEY" ] && bailout
631 # they have asked to stop configuring the interface so exit
632 [ -z "$IFACEDONE" ] || bailout
636 while [ -n "$DV" ] && [ -z "$IFACEDONE" ]; do
639 $DIALOG --yesno "$MESSAGE14" 15 50 || IFACEDONE="DONE"
641 if $DIALOG --yesno "$MESSAGE15" 12 50 ; then
643 # get persistent interface names across reboots
645 # make sure we don't run the dhcp stuff when using /etc/network/interfaces
655 ## END OF FILE #################################################################