summaryrefslogtreecommitdiffstats
path: root/source/n/wireless-tools/scripts/rc.wireless
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2012-09-26 01:10:42 +0000
committer Eric Hameleers <alien@slackware.com>2018-05-31 22:51:55 +0200
commit9664bee729d487bcc0a0bc35859f8e13d5421c75 (patch)
treeb428a16618e36ed864a8d76ea3435e19a452bf90 /source/n/wireless-tools/scripts/rc.wireless
parent75a4a592e5ccda30715f93563d741b83e0dcf39e (diff)
downloadcurrent-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.gz
current-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.xz
Slackware 14.0slackware-14.0
Wed Sep 26 01:10:42 UTC 2012 Slackware 14.0 x86_64 stable is released! We're perfectionists here at Slackware, so this release has been a long time a-brewing. But we think you'll agree that it was worth the wait. Slackware 14.0 combines modern components, ease of use, and flexible configuration... our "KISS" philosophy demands it. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Thanks to everyone who helped make this happen. The Slackware team, the upstream developers, and (of course) the awesome Slackware user community. Have fun! :-)
Diffstat (limited to 'source/n/wireless-tools/scripts/rc.wireless')
-rw-r--r--source/n/wireless-tools/scripts/rc.wireless36
1 files changed, 20 insertions, 16 deletions
diff --git a/source/n/wireless-tools/scripts/rc.wireless b/source/n/wireless-tools/scripts/rc.wireless
index 5d5c4be5b..51623d506 100644
--- a/source/n/wireless-tools/scripts/rc.wireless
+++ b/source/n/wireless-tools/scripts/rc.wireless
@@ -53,6 +53,11 @@
# if a network device is wireless. In newer
# kernels devices will not show up in
# /proc/net/wireless until active.
+# 16/aug/2012 * Pat Volkerding * Use several tests to determine if an interface
+# is wireless, as the reliability of any given
+# test may depend on the kernel options and the
+# wireless driver used.
+# Convert the MAC address to uppercase in sed.
# ------------------------------------------------------------------------------
LOGGER=${LOGGER:-cat}
@@ -83,16 +88,15 @@ IFCOMMAND="/sbin/ifconfig ${INTERFACE}"
is_wireless_device ()
{
- #[ -x $IWPATH/iwconfig ] || return 1
- #LC_ALL=C $IWPATH/iwconfig $1 2>&1 | \
- # grep -Eiq "no wireless extensions|no such device" || return 0
- #return 1
- if [ ! -d /sys/class/net/${1}/wireless ]; then
- # no wireless interface
- return 1
- else
- # interface has wireless extensions
- return 0
+ # Return 0 for a wireless interface, or 1 for a non-wireless interface.
+ if LC_ALL=C $IWPATH/iwconfig $1 2>&1 | grep -q "IEEE 802.11" ; then
+ return 0
+ elif [ -d /sys/class/net/${1}/wireless ]; then
+ return 0
+ elif [ "$(cat /sys/class/net/${1}/uevent | grep DEVTYPE)" = "DEVTYPE=wlan" ]; then
+ return 0
+ else # all tests failed, assume the device is not wireless (or add a better test :)
+ return 1
fi
}
@@ -106,7 +110,7 @@ is_wireless_device ${INTERFACE} || return 0 2> /dev/null || exit 0
# If we stop a wireless interface using wpa_supplicant,
# we'll kill its wpa_supplicant daemon too and exit this script:
if [ "$2" = "stop" ]; then
- WPAPID=`echo \`ps axww|grep wpa_supplicant |grep i${INTERFACE}\` |cut -f1 -d' '`
+ WPAPID=$(echo $(ps axww | grep wpa_supplicant | grep i${INTERFACE}) | cut -f1 -d' ')
[ ${WPAPID} ] && kill ${WPAPID}
return 0
fi
@@ -120,7 +124,7 @@ $IFCOMMAND up
sleep 3
# Get the MAC address for the interface
-HWADDR=`/sbin/ifconfig ${INTERFACE} | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p' | tr [a-f] [A-F]`
+HWADDR=$(/sbin/ifconfig ${INTERFACE} | sed -ne 's/.*\(..:..:..:..:..:..\).*/\U\1/p')
# Empty all wireless parameters- some of them could still be set for a previous interface:
# when rc.inet1 is sourced from rc.M all scripts are run in the same shell.
@@ -193,7 +197,7 @@ if [ -n "$MODE" ] ; then
fi
# This is a bit hackish, but should do the job right...
if [ ! -n "$NICKNAME" ] ; then
- NICKNAME=`/bin/hostname`
+ NICKNAME=$(/bin/hostname)
fi
if [ -n "$ESSID" -o -n "$MODE" ] ; then
echo "$0: $IWCOMMAND nick $NICKNAME" | $LOGGER
@@ -290,7 +294,7 @@ if [ "$WPA" = "wpa_supplicant" ] || [ "$WPA" = "wpaxsupplicant" ] && [ -x ${SUPP
[ ${WPA} = "wpaxsupplicant" ] && WPA_OPTIONS="${WPA_OPTIONS} -e" # Use external xsupplicant (disables the internal supplicant)
# We leave a running wpa_supplicant process in peace:
- WPAPID=`echo \`ps axww|grep wpa_supplicant |grep i${INTERFACE}\` |cut -f1 -d' '`
+ WPAPID=$(echo $(ps axww | grep wpa_supplicant | grep i${INTERFACE}) | cut -f1 -d' ')
if [ ${WPAPID} ]; then
echo "$0: wpa_supplicant found running already" | $LOGGER
else
@@ -307,9 +311,9 @@ if [ "$WPA" = "wpa_supplicant" ] || [ "$WPA" = "wpaxsupplicant" ] && [ -x ${SUPP
while [ $wi -lt $WPAWAIT ]; do
wi=$(($wi+1)); sleep 1
if (grep -q "^ctrl_interface=" ${WPACONF}); then
- if (LC_ALL=C ${SUPPATH}/wpa_cli -i$INTERFACE status|grep -q "^wpa_state=COMPLETED"); then break; fi
+ if (LC_ALL=C ${SUPPATH}/wpa_cli -i$INTERFACE status | grep -q "^wpa_state=COMPLETED"); then break; fi
else
- if (LC_ALL=C ${IWCOMMAND}|grep -Eq "Encryption key:....-"); then break; fi
+ if (LC_ALL=C ${IWCOMMAND} | grep -Eq "Encryption key:....-"); then break; fi
fi
done
if [ $wi -eq $WPAWAIT ]; then