summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wicki <gandro@gmx.net>2013-07-23 21:44:40 +0200
committerSebastian Wicki <gandro@gmx.net>2013-07-23 21:44:40 +0200
commit5b0c7cae3e82c96058605941273e33632ec95094 (patch)
treeab9fddd4a520afe709779c811307d1ce7dc78584
parent6bd3fb709988d931e92ddaa5c493be6906a07890 (diff)
downloadnetctl-5b0c7cae3e82c96058605941273e33632ec95094.tar.gz
netctl-5b0c7cae3e82c96058605941273e33632ec95094.tar.xz
Rework some lines in netctl-auto
-rwxr-xr-xsrc/netctl-auto10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/netctl-auto b/src/netctl-auto
index a7e1250..7519325 100755
--- a/src/netctl-auto
+++ b/src/netctl-auto
@@ -1,9 +1,13 @@
#! /bin/bash
+# Contributed by: Sebastian Wicki <gandro@gmx.net>
. /usr/lib/network/globals
. "$SUBR_DIR/wpa"
. "$SUBR_DIR/rfkill"
+: ${ACTIOND:=wpa_actiond -p /run/wpa_supplicant}
+: ${ACTION_SCRIPT:=$SUBR_DIR/auto.action}
+
usage() {
cat << END
Usage: netctl-auto {COMMAND} ...
@@ -115,7 +119,7 @@ switch_to() {
# List of enabled networks
local enabled_networks=$(wpa_call "$interface" list_networks | tail -n+2 | \
- cut -f 1,4 | fgrep -v "[DISABLED]" | cut -f 1 | tr "\n" ' ')
+ cut -f 1,4 | grep -Fv "[DISABLED]" | cut -f 1 | tr "\n" ' ')
reenable_networks() {
for network in $enabled_networks; do
@@ -147,7 +151,7 @@ current() {
for interface in $(list_actiond_interfaces); do
local state=$(wpa_get_state "$interface")
if [[ "$state" == "COMPLETED" ]]; then
- wpa_call "$interface" status | grep '^id_str=' | cut -d'=' -f2-
+ wpa_call "$interface" status | sed -n 's/^id_str=//p'
fi
done
}
@@ -249,8 +253,6 @@ case $# in
switch_to "$2";;
start|stop)
ensure_root "$(basename "$0")"
- : ${ACTIOND:=wpa_actiond -p /run/wpa_supplicant}
- : ${ACTION_SCRIPT:=$SUBR_DIR/auto.action}
"$1" "$2";;
*)
exit_error "$(usage)";;