diff options
author | James Meyer <james.meyer@operamail.com> | 2009-07-13 16:49:28 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2009-07-13 16:49:28 (GMT) |
commit | 8f6f144efb012ee8acd9855fd78403be35d09bd5 (patch) | |
tree | 5e09e5cd47ab1b6332d8ac78fd841623c3612c5b /abs/core-testing/LinHES-config/install_functions.sh | |
parent | 0f86eafff7f08b67668b380b9cd32090d1514d3d (diff) | |
download | linhes_pkgbuild-8f6f144efb012ee8acd9855fd78403be35d09bd5.zip linhes_pkgbuild-8f6f144efb012ee8acd9855fd78403be35d09bd5.tar.gz linhes_pkgbuild-8f6f144efb012ee8acd9855fd78403be35d09bd5.tar.bz2 |
linhes-config: add request_dhcp function
Diffstat (limited to 'abs/core-testing/LinHES-config/install_functions.sh')
-rwxr-xr-x | abs/core-testing/LinHES-config/install_functions.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh index 9b39437..94b4375 100755 --- a/abs/core-testing/LinHES-config/install_functions.sh +++ b/abs/core-testing/LinHES-config/install_functions.sh @@ -232,6 +232,53 @@ function init_network { rest_of_network fi fi + + + + +} + +function dev_up_check(){ + /sbin/ifconfig $1 1>/dev/null 2>/dev/null + status=$? + if [ $status -eq 1 ] + then + return 0 + else + devip=`/sbin/ifconfig | grep -C1 $1| grep inet|grep -v inet6 | cut -d: -f2 | awk '{ print $1}'` + if [ "x$devip" = "x" ] + then + return 1 + else + return 0 + fi + fi +} + +function request_dhcp(){ + for ndev in eth0 eth1 wlan0 wlan1 ath0 + do + dev_up_check $ndev + status=$? + if [ $status -eq 1 ] + then + #interface is down, lets see if dhcp responds + dhcpcd -Td -t2 $ndev > /tmp/dhcpinfo.$ndev + TEMPVAR=`grep IPADDR /tmp/dhcpinfo.$ndev |cut -d\' -f2` + if [ ! x$TEMPVAR = x ] + then + update_db_settings HostIP$ndev "$TEMPVAR" + TEMPVAR=`grep NETMASK /tmp/dhcpinfo.$ndev |cut -d\' -f2` + nm=`/usr/bin/nmconv.py -obits $TEMPVAR` + TEMPVAR="/$nm $TEMPVAR" + update_db_settings HostNETMASK$ndev "$TEMPVAR" + TEMPVAR=`grep GATEWAYS /tmp/dhcpinfo.$ndev |cut -d\' -f2` + update_db_settings HostGW$ndev "$TEMPVAR" + TEMPVAR=`grep DNSSERVERS /tmp/dhcpinfo.$ndev |cut -d\' -f2` + update_db_settings HostDNS$ndev "$TEMPVAR" + fi + fi + done } function init_remote { |