summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2008-01-13 10:57:13 +0100
committerJames Rayner <james@archlinux.org>2008-01-13 10:57:13 +0100
commitb5019b2056a9f0d603fb1e60065ae007bd04e13b (patch)
treed3f7ef958ef696cc2fd8cc40e6667f8edf18c7fb /contrib
parent36c19e429986e4ef52069399b850bee03b1a7925 (diff)
downloadnetctl-b5019b2056a9f0d603fb1e60065ae007bd04e13b.tar.gz
netctl-b5019b2056a9f0d603fb1e60065ae007bd04e13b.tar.xz
Fix Error 12: File not found error, and make netcfg-auto-wireless output look better
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/netcfg-auto-wireless24
1 files changed, 18 insertions, 6 deletions
diff --git a/contrib/netcfg-auto-wireless b/contrib/netcfg-auto-wireless
index 02533c8..e4cf869 100755
--- a/contrib/netcfg-auto-wireless
+++ b/contrib/netcfg-auto-wireless
@@ -3,7 +3,8 @@
. /usr/lib/network/network.subr
. /usr/lib/network/wireless.subr
-
+. /etc/rc.conf
+. /etc/rc.d/functions
# wifi_auto
# autoconnect wireless interface
# $1 - wireless interface
@@ -11,6 +12,15 @@
wifi_auto()
{
INTERFACE=$1; RETRIES=6
+ stat_busy "Scanning for networks"
+
+ networks="$(list_networks $INTERFACE)"
+
+ if [[ ! "$networks" ]]; then
+ stat_append "- No networks available."
+ stat_fail
+ exit 1
+ fi
while read essid; do
# awfully long grep that finds a file which has:
@@ -19,14 +29,16 @@ wifi_auto()
if [[ -n "$profile" ]]; then
break # If we found a profile, use it.
fi
- done < "$(list_networks $INTERFACE)"
+ done < $networks
# If there's a profile, connect, else fail.
if [[ -n "$profile" ]]; then
- netcfg2 $(basename $profile)
- exit $?
+ stat_done
+ netcfg2 $(basename $profile)
+ exit $?
else
- err "No network found"
+ stat_append "- No profiles matched the found networks"
+ stat_fail
exit 1
fi
}
@@ -39,5 +51,5 @@ if [[ -z $1 ]]; then
err "Please supply an interface to connect"
exit 1
fi
-
wifi_auto $1
+