Deleted media-libs/SoQt-1.4.1-r1: now in Portage.
[underlay.git] / net-wireless / wpa_supplicant / files / wpa_cli.sh
blobd7d340b90bb6fc198d095e080af53a7118223cd0
1 #!/bin/sh
2 # Copyright 1999-2006 Gentoo Foundation
3 # Written by Roy Marples <uberlord@gentoo.org>
4 # Distributed under the terms of the GNU General Public License v2
5 # Alternatively, this file may be distributed under the terms of the BSD License
6 # $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_cli.sh,v 1.1 2006/07/11 15:07:16 uberlord Exp $
8 if [ -z "$1" -o -z "$2" ]; then
9 logger -t wpa_cli "Insufficient parameters"
10 exit 1
13 INTERFACE="$1"
14 ACTION="$2"
16 # Note, the below action must NOT mark the interface down via ifconfig, ip or
17 # similar. Addresses can be removed, changed and daemons can be stopped, but
18 # the interface must remain up for wpa_supplicant to work.
20 if [ -f /etc/gentoo-release ]; then
21 EXEC="/etc/init.d/net.${INTERFACE} --quiet"
22 else
23 logger -t wpa_cli "I don't know what to do with this distro!"
24 exit 1
27 case ${ACTION} in
28 CONNECTED)
29 EXEC="${EXEC} start"
31 DISCONNECTED)
32 EXEC="${EXEC} stop"
35 logger -t wpa_cli "Unknown action ${ACTION}"
36 exit 1
38 esac
40 # ${EXEC} can use ${IN_BACKGROUND} so that it knows that the user isn't
41 # stopping the interface and a background process - like wpa_cli - is.
42 export IN_BACKGROUND=true
44 logger -t wpa_cli "interface ${INTERFACE} ${ACTION}"
45 ${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed"