X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fnetcardconfig;h=cffa86ab458c1aa02ede58976da10dbf753589c0;hb=1c62e0a32b4732d2fe8195d9777a8d7e1a4964e1;hp=f57552b3594fbcfda9d48b77fb3194ce7c8826f2;hpb=eebbac24ec6479c6c88593892f7d1616b91ccc19;p=grml-network.git diff --git a/sbin/netcardconfig b/sbin/netcardconfig index f57552b..cffa86a 100755 --- a/sbin/netcardconfig +++ b/sbin/netcardconfig @@ -190,10 +190,11 @@ configiface() { DV=$DEVICENAME ifdown "${DV}" --force sleep 3 - # wireless config - WLDEVICECOUNT="$(LANG=C LC_MESSAGEWS=C iwconfig "$DV" 2>/dev/null | wc -l)" + # INTERACTIVE=true if "${INTERACTIVE}" ; then + # Setup wireless options? if [ $iswireless -gt 0 ] && $DIALOG --yesno "$MESSAGE13" 8 45; then + WLDEVICECOUNT="$(LANG=C LC_MESSAGEWS=C iwconfig "$DV" 2>/dev/null | wc -l)" ESSID="" NWID="" MODE="" @@ -433,7 +434,7 @@ configiface() { read -r IWPRIV <"$TMP" ; rm -f "$TMP" writeiwline - fi + fi # Setup wireless options? # Configure VLAN on this interface? if $DIALOG --defaultno --yesno "$MESSAGE16" 8 45; then @@ -445,8 +446,9 @@ configiface() { DV="vlan$VLAN" fi fi - fi + fi # INTERACTIVE=true + # Use DHCP broadcast? if ("${INTERACTIVE}" && "${DIALOG}" --yesno "${MESSAGE2}" 8 45) || \ (! "${INTERACTIVE}" && [[ "${METHOD}" == 'dhcp' ]]) ; then if [ -w /etc/network/interfaces ]; then @@ -511,7 +513,7 @@ configiface() { #addauto fi - fi + fi # Use DHCP broadcast? echo "Done." } @@ -683,7 +685,20 @@ while (true); do $DIALOG --menu "$MESSAGE1" 18 60 12 "${DEVICELIST[@]}" "${EXITMENU[@]}" 2>"$TMP" || bailout read -r DV <"$TMP" ; rm -f "$TMP" else - DV="${NET_DEV}" + # we have interface name so we need to find its number in NETDEVICES + DV=0 + found=false + for DV in "${!NETDEVICES[@]}"; do + if [[ "${NETDEVICES[$DV]}" =~ ^"${NET_DEV} " ]]; then + found=true + break + fi + done + if ! "${found}"; then + echo "There is no interface ${NET_DEV} in the system" >&2 + bailout 1 + fi + [[ -z "${IFACEDONE}" ]] || bailout fi [ "$DV" = "$EXITKEY" ] && bailout