From 4e034777fa0bfffa11d87b602e6b2b941edd3262 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Thu, 21 Jun 2012 12:13:26 +0200 Subject: Minor improvements After this change, a profile started by a previous version of netcfg can potentially not be brought down anymore. This only concerns the updating process. Running `netcfg clean` should make everything OK again (potentially leaving your network down, but you can now bring up profiles again). --- src/8021x | 7 +++---- src/globals | 5 ++--- src/network | 9 +++------ 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/8021x b/src/8021x index 1dd0408..d92ccbe 100644 --- a/src/8021x +++ b/src/8021x @@ -51,7 +51,7 @@ stop_wpa() sleep 1 # JP: need this else the file tends to disappear after [[ -f ... ]] but before cat... # see if [[ -f "/run/wpa_supplicant_$1.pid" ]]; then - kill "$(cat "/run/wpa_supplicant_$1.pid")" &>/dev/null & + kill "$(< "/run/wpa_supplicant_$1.pid")" &>/dev/null & fi } @@ -173,7 +173,7 @@ wpa_supplicant_scan_info() { return 1 fi - echo $essids + echo "$essids" return 0 } @@ -203,7 +203,7 @@ make_wpa_config() { echo "ssid=\"$ESSID\"" ;; hex) - # Hex ESSID is written unquoted ans lowercase (FS#24333) + # Hex ESSID is written unquoted and in lowercase (FS#24333) echo "ssid=${ESSID,,}" ;; *) @@ -255,4 +255,3 @@ make_wpa_config() { } # vim: ft=sh ts=4 et sw=4 tw=0: - diff --git a/src/globals b/src/globals index f8d30ef..0d573e2 100644 --- a/src/globals +++ b/src/globals @@ -73,8 +73,7 @@ function exit_fail { report_fail "$*"; exit 1; } # Return 0 if it's "yes" (et al), nonzero otherwise. # To default to yes, do: "checkyesno ${VAR:-yes}". # -checkyesno() -{ +function checkyesno() { local _value="$1" #debug "checkyesno: $1 is set to $_value." case "$_value" in @@ -89,7 +88,7 @@ checkyesno() return 1 ;; *) - #warn "\$${1} is not set properly - see ${rcvar_manpage}." + #warn "\$${1} is not set properly - see rc.conf(5)." return 1 ;; esac diff --git a/src/network b/src/network index e8c2ae1..1c466c7 100644 --- a/src/network +++ b/src/network @@ -295,11 +295,8 @@ interface_reconnect() # Return 1 if interface down and available to be used # check_iface() { - if [[ -f "$STATE_DIR/interfaces/$1" ]]; then ( - . "$STATE_DIR/interfaces/$1" - echo "$PROFILE" # may be: external, disabled, or a profile name - return 0 - ) + if [[ -f "$STATE_DIR/interfaces/$1" ]]; then + echo "$(< "$STATE_DIR/interfaces/$1")" return 0 else return 1 @@ -347,7 +344,7 @@ set_profile() { set_iface() { local PROFILE="${3:-external}" if [[ "$1" == "up" ]]; then - echo "PROFILE='$PROFILE'" > "$STATE_DIR/interfaces/$2" + echo "$PROFILE" > "$STATE_DIR/interfaces/$2" elif [[ "$1" == "down" ]]; then rm -f "$STATE_DIR/interfaces/$2" # JP: add -f so we don't complain if the interface isn't up fi -- cgit v1.2.3-24-g4f1b