rc-scripts/trunk/sysconfig/network-scripts: functions.network ifup
arekm
cvs at pld-linux.org
Thu Aug 31 09:26:29 CEST 2006
Author: arekm
Date: Thu Aug 31 09:26:25 2006
New Revision: 7692
Modified:
rc-scripts/trunk/sysconfig/network-scripts/functions.network
rc-scripts/trunk/sysconfig/network-scripts/ifup
Log:
Detect if wireless interface is turned on.
Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network (original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network Thu Aug 31 09:26:25 2006
@@ -512,10 +512,16 @@
echo $output | LC_ALL=C grep -q "Link detected: no" && return 0 || return 2
}
+check_iwconfig ()
+{
+ [ -x /sbin/iwconfig ] || return 2
+ output=$(LC_ALL=C iwconfig $1 2>&1)
+ echo $output | LC_ALL=C grep -q "radio off" && return 0 || return 2
+}
check_link_down ()
{
- if [ -x /sbin/mii-tool -o -x /sbin/ethtool ]; then
+ if [ -x /sbin/mii-tool -o -x /sbin/ethtool -o -x /sbin/iwconfig ]; then
if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP ; then
ip link set dev $1 up >/dev/null 2>&1
timeout=0
@@ -524,10 +530,12 @@
m=$?
check_ethtool $1
e=$?
+ check_iwconfig $1
+ i=$?
if [ $m -eq 1 ] || [ $e -eq 1 ] ; then
return 1
fi
- if [ $m -eq 2 ] && [ $e -eq 2 ] ; then
+ if [ $m -eq 2 ] && [ $e -eq 2 ] && [ $i -eq 2 ]; then
return 1
fi
usleep 500000
Modified: rc-scripts/trunk/sysconfig/network-scripts/ifup
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifup (original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifup Thu Aug 31 09:26:25 2006
@@ -165,8 +165,8 @@
DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS"
if check_link_down ${DEVICE}; then
- run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false
- nls '%s: Check cable?' "$DEVICE"
+ run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "$(basename $DHCP_CLIENT)")" /bin/false
+ nls '%s: Check cable/radio on-off switch?' "$DEVICE"
exit 1
fi
More information about the pld-cvs-commit
mailing list