replaced iwconfig with iw -- better diagnostics for dhclient

EAP-support
KatolaZ 8 years ago
parent 9d819b2b4a
commit 7376d8543e
  1. 44
      setnet.sh

@ -47,7 +47,7 @@ DIALOG="dialog --backtitle \"${TOPSTR}\" "
## the script will exit ## the script will exit
## ##
HARD_DEPS="ip dhclient dialog iwconfig" HARD_DEPS="ip dhclient dialog iw sed grep cat awk which"
## ##
## Suggested dependencies. The script will issue a warning if any of ## Suggested dependencies. The script will issue a warning if any of
@ -376,7 +376,9 @@ DEVNAME=$1
fi fi
DEVMAC=$(ip link show "${DEVNAME}" | tail -n +2 | sed -r 's/^\ +//g' | cut -d " " -f 2) DEVMAC=$(ip link show "${DEVNAME}" | tail -n +2 | sed -r 's/^\ +//g' | cut -d " " -f 2)
DEVCONF="MAC: ${DEVMAC}\n" DEV_STATUS=$(ip -o link | cut -d " " -f 2,9 | grep -E "^${DEVNAME}: " | cut -d " " -f 2)
DEVCONF="MAC: ${DEVMAC}\nLINK STATUS: ${DEV_STATUS}\n"
log "show_device_conf" "NET_FAMILIES: \"${NET_FAMILIES}\"" log "show_device_conf" "NET_FAMILIES: \"${NET_FAMILIES}\""
@ -470,11 +472,16 @@ ${DEV_IP}\n${DEV_NET}\n${DEV_NETMASK}\n${DEV_GW}\n${DEV_DNS1}\n${DEV_DNS2}'\
config_ethernet_dhcp(){ config_ethernet_dhcp(){
##local ##local
DEVNAME=$1 DEVNAME=$1
eval "${DIALOG} --msgbox 'Running \"dhclient ${DEVNAME}\"' ${INFO_HEIGHT} ${INFO_WIDTH}" ##eval "${DIALOG} --msgbox 'Running \"dhclient ${DEVNAME}\"' ${INFO_HEIGHT} ${INFO_WIDTH}"
dhclient -r ${DEVNAME} dhclient -r ${DEVNAME} 2>/dev/null
dhclient ${DEVNAME} dhclient -v ${DEVNAME} 2>&1 |
eval "${DIALOG} --clear --title 'Running dhclient...' \
--programbox ${WINDOW_HEIGHT} ${WINDOW_WIDTH}" 2>${TMPFILE}
if [ $! -ne 0 ];then
log "config_ethernet_dhcp" "dhclient aborted"
fi
show_device_conf ${DEVNAME} show_device_conf ${DEVNAME}
} }
@ -1012,19 +1019,18 @@ configure_device(){
##local ##local
DEVNAME=$1 DEVNAME=$1
## Check if the network device is a wifi -- WEAK ## Check if the network device is a wifi -- this should be more robust...
IS_WIFI=$(iwconfig ${DEVNAME} 2>/dev/null | grep -c "IEEE 802.11") iw ${DEVNAME} info 2>&1 >/dev/null
case ${IS_WIFI} in case $? in
0) 0)
config_ethernet ${DEVNAME} config_wifi ${DEVNAME}
;; ;;
*) *)
config_wifi ${DEVNAME} config_ethernet ${DEVNAME}
;; ;;
esac esac
} }

Loading…
Cancel
Save