summaryrefslogtreecommitdiff
path: root/user/wpa_supplicant/wpa_cli.sh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-12-02 17:23:54 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-12-02 17:23:54 +0000
commit7d2b8e4aa3bdd1fc0d59225e0c84740d8f8baea9 (patch)
tree4bdece1f7f9ee91ddd587aa7aa29750c0e0eb89c /user/wpa_supplicant/wpa_cli.sh
parentfb8bb9a735aebcac3e57582979fa61e82f175374 (diff)
downloadpackages-7d2b8e4aa3bdd1fc0d59225e0c84740d8f8baea9.tar.gz
packages-7d2b8e4aa3bdd1fc0d59225e0c84740d8f8baea9.tar.bz2
packages-7d2b8e4aa3bdd1fc0d59225e0c84740d8f8baea9.tar.xz
packages-7d2b8e4aa3bdd1fc0d59225e0c84740d8f8baea9.zip
user/wpa_supplicant: fix up for autostarting
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"