summaryrefslogtreecommitdiff
path: root/user/wpa_supplicant/wpa_cli.sh
diff options
context:
space:
mode:
Diffstat (limited to 'user/wpa_supplicant/wpa_cli.sh')
-rw-r--r--user/wpa_supplicant/wpa_cli.sh36
1 files changed, 20 insertions, 16 deletions
diff --git a/user/wpa_supplicant/wpa_cli.sh b/user/wpa_supplicant/wpa_cli.sh
index 0a5a6cc03..ee80e76e9 100644
--- a/user/wpa_supplicant/wpa_cli.sh
+++ b/user/wpa_supplicant/wpa_cli.sh
@@ -1,33 +1,37 @@
#!/bin/sh
# Distributed under the terms of the BSD License.
-# Copyright (c) 2015 Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Copyright 1999-2011 Gentoo Foundation
+# Written by Roy Marples <uberlord@gentoo.org>
+# Copyright 2018 Adélie Linux.
-IFUP="/sbin/ifup"
-IFDOWN="/sbin/ifdown"
-
-if [ -z "${1}" -o -z "${2}" ]; then
- logger -t wpa_cli "this script should be called from wpa_cli(8)"
- exit 1
-elif ! [ -x "${IFUP}" -a -x "${IFDOWN}" ]; then
- logger -t wpa_cli "${IFUP} or ${IFDOWN} doesn't exist"
+if [ -z "$1" -o -z "$2" ]; then
+ logger -t wpa_cli "Insufficient parameters"
exit 1
fi
-IFNAME="${1}"
-ACTION="${2}"
+INTERFACE="$1"
+ACTION="$2"
+
+EXEC="/etc/init.d/net.${INTERFACE} --quiet"
-EXEC=""
case "${ACTION}" in
CONNECTED)
- EXEC="${IFUP}"
+ EXEC="${EXEC} start"
;;
DISCONNECTED)
- EXEC="${IFDOWN}"
+ # Deactivated, since stopping /etc/init.d/net.wlanX
+ # stops the network completly.
+ EXEC="false ${EXEC} stop"
;;
*)
- logger -t wpa_cli "unknown action '${ACTION}'"
+ logger -t wpa_cli "Unknown action '${ACTION}'"
exit 1
+ ;;
esac
+# netifrc 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 ${IFNAME} ${ACTION}"
-${EXEC} "${IFNAME}" || logger -t wpa_cli "executing '${EXEC}' failed"
+${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed"