/usr/share/whereami/tests/testsupplicant is in whereami 0.3.34-0.3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/bin/sh
#
# Author: Andrew McMillan
# Written: 8th July 2005 (Debconf5, Helsinki)
#
# This script is designed to help whereami work with the wpasupplicant
# package. We make the assumption that wpasupplicant is running and
# that you have at least got it working manually, and now you want to
# use it with whereami...
#
# We seem to need to do several things:
# - Configure for null encryption and "open" mode
# - Bring the interface up.
# - Kick the wpa_supplicant daemon
# - Either:
# - Watch the wpa_cli status output for COMPLETED
# - Watch the iwconfig output until we see a real encryption key
#
# Turn on execution tracing, for debugging...
[ -n "$DEBUGWHEREAMI" ] && set -o xtrace
MAXATTEMPTS=15
# # Perhaps this is needs to be optional - if so, tell me please!
iwconfig ${INTERFACE} enc "ffff-ffff-ff" enc open
ifconfig ${INTERFACE} up
ACTION=start
if pgrep wpa_supplicant >/dev/null ; then
ACTION=reload
fi
if [ -x /etc/init.d/wpasupplicant ] ; then
/etc/init.d/wpasupplicant "${ACTION}"
else
# Kill any existing supplicant, sleeping briefly if we did so
pkill wpa_supplicant && sleep 1
# Start a new supplicant
/sbin/wpa_supplicant -B -Dwext -i${INTERFACE} -c/etc/wpa_supplicant.conf
echo "$!" >/var/run/whereami/supplicant.pid
fi
while [ "$MAXATTEMPTS" -gt "0" ] ; do
if /sbin/wpa_cli -i ${INTERFACE} status | grep 'wpa_state=COMPLETED' >/dev/null ; then
# Success
exit 0
fi
if [ "`iwconfig ${INTERFACE} | grep Encryption | cut -f3 -d: `" = "restricted" ] ; then
# Success
exit 0
fi
# Otherwise we loop again until we have exceeded the timeout...
sleep 1
MAXATTEMPTS=$(( $MAXATTEMPTS - 1 ))
done
# Failed to work within timeout
if [ -x /etc/init.d/wpasupplicant ] ; then
/etc/init.d/wpasupplicant stop
else
pkill wpa_supplicant
fi
exit 1
|