summaryrefslogtreecommitdiff
path: root/harmony/wpa_supplicant/wpa_cli.sh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-27 14:34:02 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-27 14:34:02 -0600
commit7553795ec2d735c01dbdde129a65b7f45d5aa999 (patch)
treeb3970009a8246b0c17a105fe6b10c8077fc2b763 /harmony/wpa_supplicant/wpa_cli.sh
parente2b01859c88d221992403d1293d42da33002be4d (diff)
downloadpackages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.gz
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.bz2
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.tar.xz
packages-7553795ec2d735c01dbdde129a65b7f45d5aa999.zip
Add harmony/ repo for packages still being discussed
See https://wiki.adelielinux.org/wiki/Project:Harmony
Diffstat (limited to 'harmony/wpa_supplicant/wpa_cli.sh')
-rw-r--r--harmony/wpa_supplicant/wpa_cli.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/harmony/wpa_supplicant/wpa_cli.sh b/harmony/wpa_supplicant/wpa_cli.sh
new file mode 100644
index 000000000..0a5a6cc03
--- /dev/null
+++ b/harmony/wpa_supplicant/wpa_cli.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Distributed under the terms of the BSD License.
+# Copyright (c) 2015 Sören Tempel <soeren+alpine@soeren-tempel.net>
+
+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"
+ exit 1
+fi
+
+IFNAME="${1}"
+ACTION="${2}"
+
+EXEC=""
+case "${ACTION}" in
+ CONNECTED)
+ EXEC="${IFUP}"
+ ;;
+ DISCONNECTED)
+ EXEC="${IFDOWN}"
+ ;;
+ *)
+ logger -t wpa_cli "unknown action '${ACTION}'"
+ exit 1
+esac
+
+logger -t wpa_cli "interface ${IFNAME} ${ACTION}"
+${EXEC} "${IFNAME}" || logger -t wpa_cli "executing '${EXEC}' failed"