blob: a60a13c4fc2327525387f6746fa82a1779b154ea (
plain)
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
|
#!/bin/sh
# Copyright 1999-2011 Gentoo Foundation
# Written by Roy Marples <uberlord@gentoo.org>
# Distributed under the terms of the GNU General Public License v2
# Alternatively, this file may be distributed under the terms of the BSD License
if [ -z "$1" -o -z "$2" ]; then
logger -t wpa_cli "Insufficient parameters"
exit 1
fi
INTERFACE="$1"
ACTION="$2"
# Note, the below action must NOT mark the interface down via ifconfig, ip or
# similar. Addresses can be removed, changed and daemons can be stopped, but
# the interface must remain up for wpa_supplicant to work.
if [ -f /etc/parabola-release ]; then
EXEC="/etc/init.d/net.${INTERFACE} --quiet"
else
logger -t wpa_cli "I don't know what to do with this distro!"
exit 1
fi
case ${ACTION} in
CONNECTED)
EXEC="${EXEC} start"
;;
DISCONNECTED)
# Deactivated, since stopping /etc/init.d/net.wlanX
# stops the network completly.
EXEC="false ${EXEC} stop"
;;
*)
logger -t wpa_cli "Unknown action ${ACTION}"
exit 1
;;
esac
# ${EXEC} can use ${IN_BACKGROUND} so that it knows that the user isn't
# stopping the interface and a background process - like wpa_cli - is.
export IN_BACKGROUND=true
logger -t wpa_cli "interface ${INTERFACE} ${ACTION}"
${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed"
|