~ubuntu-branches/ubuntu/maverick/wpasupplicant/maverick

« back to all changes in this revision

Viewing changes to debian/ifupdown/action_wpa.sh

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2009-05-16 03:47:08 UTC
  • mfrom: (4.1.5 karmic)
  • Revision ID: james.westby@ubuntu.com-20090516034708-pkqje2dgvhj6tb2i
Tags: 0.6.9-3
Drop debian/patches/12_syslog_supplement.patch. It adds code which
attempts to prettify output but doesn't handle large output well.
(Closes: #528639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Action script to enable/disable wpa-roam interfaces in reaction to
 
4
# pm-action or ifplugd events.
 
5
#
 
6
# Copyright: Copyright (c) 2008-2009, Kel Modderman <kel@otaku42.de>
 
7
# License:   GPL-2
 
8
#
 
9
 
 
10
PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
11
 
 
12
if [ ! -x /sbin/wpa_action ]; then
 
13
        exit 0
 
14
fi
 
15
 
 
16
SELF=action_wpa
 
17
COMMAND=
 
18
IFPLUGD_IFACE=
 
19
 
 
20
# pm-action(8) - <action> <suspend method>
 
21
#
 
22
# On suspend|hibernate, disconnect any wpa-roam managed interfaces,
 
23
# reconnect it on resume.
 
24
 
 
25
case "${1}" in
 
26
        suspend|hibernate)
 
27
                COMMAND=disconnect
 
28
                ;;
 
29
        resume|thaw)
 
30
                COMMAND=reconnect
 
31
                ;;
 
32
esac
 
33
 
 
34
if [ -z "$COMMAND" ]; then
 
35
        # ifplugd(8) - <iface> <action>
 
36
        #
 
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.
 
40
 
 
41
        IFPLUGD_IFACE="${1}"
 
42
 
 
43
        case "${2}" in
 
44
                up)
 
45
                        COMMAND=disconnect
 
46
                        ;;
 
47
                down)
 
48
                        COMMAND=reconnect
 
49
                        ;;
 
50
                *)
 
51
                        echo "${SELF}: unknown $0 arguments: ${@}" >&2
 
52
                        exit 1
 
53
                        ;;
 
54
        esac
 
55
fi
 
56
 
 
57
if [ -z "$COMMAND" ]; then
 
58
        echo "${SELF}: unknown arguments: ${@}" >&2
 
59
        exit 1
 
60
fi
 
61
 
 
62
for CTRL in /var/run/wpa_supplicant/*; do
 
63
        [ -S "${CTRL}" ] || continue
 
64
 
 
65
        IFACE="${CTRL#/var/run/wpa_supplicant/}"
 
66
 
 
67
        wpa_action "${IFACE}" check || continue
 
68
 
 
69
        if [ "${IFPLUGD_IFACE}" ] && [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then
 
70
                # if ifplugd is managing this interface (not likely but..)
 
71
                # do nothing
 
72
                continue
 
73
        fi
 
74
 
 
75
        wpa_cli -i "${IFACE}" "${COMMAND}"
 
76
done