~ubuntu-branches/ubuntu/lucid/wpasupplicant/lucid-security

« back to all changes in this revision

Viewing changes to debian/wpasupplicant.wpa-ifupdown.init

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-12-02 20:52:16 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081202205216-72fqozu84sdt89a8
Tags: 0.6.4-3
Bugfix: "Missing -d in testing for a directory in init script". 
Thanks to Braun Gábor <braung@renyi.hu> for reporting and the patch.
(Closes: #506328)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
3
### BEGIN INIT INFO
4
 
# Provides:             wpa-ifupdown
5
 
# Required-Start:       $network
6
 
# Required-Stop:        $network
 
4
# Provides:             wpa-ifupdown
 
5
# Required-Start:       $network
 
6
# Required-Stop:        $network $remote_fs
7
7
# Should-Start:
8
8
# Should-Stop:
9
9
# Default-Start:
10
 
# Default-Stop:         0 6
11
 
# Short-Description:    Stop wpa_supplicant processes started via ifupdown
12
 
# Description:          Run ifdown on interfaces authenticated via
13
 
#                       wpa_supplicant. Sendsigs terminates wpa_supplicant
14
 
#                       processes before networking is stopped causing each
15
 
#                       network interface authenticated via a wpa_supplicant
16
 
#                       daemon to be terminated abrubtly.
 
10
# Default-Stop:         0 6
 
11
# Short-Description:    Stop wpa_supplicant processes started via ifupdown
 
12
# Description:          Run ifdown on interfaces authenticated via
 
13
#                       wpa_supplicant. Sendsigs terminates wpa_supplicant
 
14
#                       processes before networking is stopped causing each
 
15
#                       network interface authenticated via a wpa_supplicant
 
16
#                       daemon to be terminated abrubtly.
 
17
#                       Since initscripts package version 2.86.ds1-48 an
 
18
#                       interface exists to omit process id's from sendsigs. If
 
19
#                       this interface is present this script is a no-op.
17
20
### END INIT INFO
18
21
 
19
22
PATH=/usr/sbin:/usr/bin:/sbin:/bin
25
28
. /lib/lsb/init-functions
26
29
 
27
30
stop_wpa_action () {
28
 
        test -x /sbin/wpa_action || return
29
 
        unset IFACES
30
 
        IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_action.*.pid' -printf '%P\n' | cut -d'.' -f2)
 
31
        test -x /sbin/wpa_action || return 0
 
32
        IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_action.*.pid' -printf '%P\n' | \
 
33
                cut -d'.' -f2 2>/dev/null)
31
34
        if test -n "$IFACES"; then
32
35
                log_daemon_msg "Stopping wpa_action roaming interfaces"
33
36
                for iface in $IFACES; do
40
43
}
41
44
 
42
45
stop_wpa_supplicant () {
43
 
        unset IFACES
44
 
        IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_supplicant.*.pid' -printf '%P\n' | cut -d'.' -f2)
 
46
        IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_supplicant.*.pid' -printf '%P\n' | \
 
47
                grep -v wpa_supplicant.dbus.pid | cut -d'.' -f2 2>/dev/null)
45
48
        if test -n "$IFACES"; then
46
49
                log_daemon_msg "Stopping wpa_supplicant interfaces"
47
50
                for iface in $IFACES; do
48
51
                        log_progress_msg "$iface"
49
 
                        ifdown $iface >/dev/null 2>&1
 
52
                        ifdown "$iface" >/dev/null 2>&1
50
53
                done
51
54
                log_end_msg 0
52
55
        fi
53
56
}
54
57
 
 
58
sendsigs_omission_support () {
 
59
        if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then
 
60
                # Debian
 
61
                return 0
 
62
        elif [ -d /var/run/sendsigs.omit.d/ ]; then
 
63
                # Ubuntu, cf. https://bugs.launchpad.net/bugs/181541
 
64
                return 0
 
65
        fi
 
66
 
 
67
        return 1
 
68
}
 
69
 
55
70
case "$1" in
56
71
        start|restart|force-reload)
57
72
                # No-op
58
73
                ;;
59
74
        stop)
60
 
                stop_wpa_action
61
 
                stop_wpa_supplicant
 
75
                if sendsigs_omission_support; then
 
76
                        stop_wpa_action
 
77
                else
 
78
                        stop_wpa_action
 
79
                        stop_wpa_supplicant
 
80
                fi
62
81
                ;;
63
82
        *)
64
83
                echo "Usage: $0 {start|stop|restart|force-reload}" >&2