From 5b0c7cae3e82c96058605941273e33632ec95094 Mon Sep 17 00:00:00 2001 From: Sebastian Wicki Date: Tue, 23 Jul 2013 21:44:40 +0200 Subject: Rework some lines in netctl-auto --- src/netctl-auto | 10 ++++++---- 1 file 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 . /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)";; -- cgit v1.2.3-24-g4f1b