3
# Action script to enable/disable wpa-roam interfaces in reaction to
4
# pm-action or ifplugd events.
6
# Copyright: Copyright (c) 2008-2009, Kel Modderman <kel@otaku42.de>
10
PATH=/sbin:/usr/sbin:/bin:/usr/bin
12
if [ ! -x /sbin/wpa_action ]; then
20
# pm-action(8) - <action> <suspend method>
22
# On suspend|hibernate, disconnect any wpa-roam managed interfaces,
23
# reconnect it on resume.
34
if [ -z "$COMMAND" ]; then
35
# ifplugd(8) - <iface> <action>
37
# If an ifplugd managed interface is brought up, disconnect any
38
# wpa-roam managed interfaces so that only one "roaming" interface
39
# remains active on the system.
51
echo "${SELF}: unknown $0 arguments: ${@}" >&2
57
if [ -z "$COMMAND" ]; then
58
echo "${SELF}: unknown arguments: ${@}" >&2
62
for CTRL in /var/run/wpa_supplicant/*; do
63
[ -S "${CTRL}" ] || continue
65
IFACE="${CTRL#/var/run/wpa_supplicant/}"
67
wpa_action "${IFACE}" check || continue
69
if [ "${IFPLUGD_IFACE}" ] && [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then
70
# if ifplugd is managing this interface (not likely but..)
75
wpa_cli -i "${IFACE}" "${COMMAND}"