summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src-wireless/netcfg-auto-wireless2
-rw-r--r--src/connections/wireless6
-rw-r--r--src/netcfg8
-rw-r--r--src/network2
-rw-r--r--src/wireless12
5 files changed, 19 insertions, 11 deletions
diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless
index 7bb8dbb..f2b934a 100644
--- a/src-wireless/netcfg-auto-wireless
+++ b/src-wireless/netcfg-auto-wireless
@@ -14,7 +14,7 @@ wifi_auto()
[[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface"
if [[ -n "$RFKILL" ]]; then
- set_rf_state "$interface" up
+ set_rf_state "$interface" up || exit $?
fi
set_interface up "$interface" # uses iproute methods---is it there any value to providing option to use ifconfig?
diff --git a/src/connections/wireless b/src/connections/wireless
index 0e7e274..955f957 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -11,12 +11,14 @@ wireless_up() {
. "$SUBR_DIR/wireless"
if [[ -n "$RFKILL" ]]; then
- if [[ ! "$(get_rf_state "$INTERFACE")" == "up" ]]; then
+ local state=$(get_rf_state "$INTERFACE") || return 1
+ if [[ "$state" != "up" ]]; then
if [[ "$RFKILL" == "soft" ]]; then
set_rf_state "$INTERFACE" up
sleep 1
else
report_fail "radio is disabled on $INTERFACE"
+ return 1
fi
fi
fi
@@ -218,7 +220,7 @@ wireless_down() {
# Any reason why a hardware switch should be considered on interface down?
if [[ "$RFKILL" == "soft" ]]; then
. "$SUBR_DIR/wireless"
- set_rf_state "$INTERFACE" down
+ set_rf_state "$INTERFACE" down || return 1
fi
}
diff --git a/src/netcfg b/src/netcfg
index 91d038e..fd589b0 100644
--- a/src/netcfg
+++ b/src/netcfg
@@ -28,7 +28,6 @@ usage()
echo "-v, version Output version information and exit"
echo " all-resume Resume previously suspended profiles and reconnect them"
echo " all-suspend Store a list of current running profiles and suspend them"
- exit 1
}
# TODO: Re-add ROOT check and rewrite with getopts from BashFAQ
@@ -38,7 +37,8 @@ case "$1" in
version
exit 0;;
--help|-h|help)
- usage;;
+ usage
+ exit 0;;
list|-l)
echo "Available Profiles"
echo "------------------"
@@ -84,12 +84,14 @@ case "$1" in
all-suspend)
all_suspend;;
-*|--*)
- usage;;
+ usage
+ exit 1;;
*)
if [[ -n "$1" ]]; then
profile_up "$1"
else
usage
+ exit 1
fi
;;
esac
diff --git a/src/network b/src/network
index f1f55cf..678fbb3 100644
--- a/src/network
+++ b/src/network
@@ -267,8 +267,8 @@ check_iface() {
else
echo "up"
fi
- exit 0
)
+ return 0
else
return 1
fi
diff --git a/src/wireless b/src/wireless
index 713beb2..d118919 100644
--- a/src/wireless
+++ b/src/wireless
@@ -136,7 +136,7 @@ wpa_supplicant_scan_info() {
[[ -z "$INTERFACE" ]] && return 1
essids=$(mktemp --tmpdir essid.XXXXXXXX)
- wpa_supplicant -B -i"$INTERFACE" -Dwext -C/var/run/wpa_supplicant -P/var/run/wpa_supplicant.pid
+ wpa_supplicant -B -i"$INTERFACE" -Dwext -C/var/run/wpa_supplicant -P/var/run/wpa_supplicant.pid || return 1
wpa_cli -i "$INTERFACE" scan &> /dev/null
sleep 2.5
wpa_cli -i "$INTERFACE" scan_results |
@@ -169,8 +169,11 @@ wpa_supplicant_scan_info() {
set_rf_state() {
local INTERFACE="$1" state="$2" PROFILE="$3"
- [[ $RFKILL == "hard" ]] && report_fail "Cannot set state on hardware rfkill switch"
- local path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME")
+ if [[ "$RFKILL" == "hard" ]]
+ report_fail "Cannot set state on hardware rfkill switch"
+ return 1
+ fi
+ local path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME") || return 1
case "$state" in
up)
echo 1 > "$path/state"
@@ -200,12 +203,13 @@ get_rf_path() {
fi
report_fail "no rfkill switch available on interface $INTERFACE"
fi
+ return 1
}
get_rf_state() {
local INTERFACE="$1" PROFILE="$2" path state
- path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME")
+ path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME") || return 1
state=$(cat "$path/state")
case "$state" in