summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src-wireless/net-auto5
-rw-r--r--src-wireless/netcfg-auto-wireless18
-rw-r--r--src/globals5
-rw-r--r--src/net-profiles8
-rw-r--r--src/net-rename9
-rw-r--r--src/netcfg1
-rw-r--r--src/netcfg-menu7
-rw-r--r--src/network1
8 files changed, 17 insertions, 37 deletions
diff --git a/src-wireless/net-auto b/src-wireless/net-auto
index 8b724a5..3f74ffc 100644
--- a/src-wireless/net-auto
+++ b/src-wireless/net-auto
@@ -1,7 +1,6 @@
#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
+. /usr/lib/network/globals
case "$1" in
start)
@@ -36,7 +35,7 @@ case "$1" in
$0 stop; sleep 1; $0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ exit_stderr "Usage: $0 {start|stop|restart}"
esac
# vim: set ts=4 et sw=4:
diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless
index e77eb0e..50d49be 100644
--- a/src-wireless/netcfg-auto-wireless
+++ b/src-wireless/netcfg-auto-wireless
@@ -3,8 +3,6 @@
. /usr/lib/network/network
. /usr/lib/network/wireless
-. /etc/rc.conf
-. /etc/rc.d/functions
# wifi_auto
# autoconnect wireless interface
@@ -12,15 +10,13 @@
wifi_auto()
{
interface=$1;
- stat_busy "Scanning for networks"
+ report_try "Scanning for networks"
ifconfig $interface up
networks="$(list_networks $interface)"
if [[ ! "$networks" ]]; then
- stat_append "- No networks available."
- stat_fail
- exit 1
+ exit_fail "- No networks available."
fi
# Loop through all the found essid's, then find a matching profile.
@@ -42,18 +38,14 @@ wifi_auto()
exit $?
fi
- stat_append "- No profiles matched the found networks"
- stat_fail
- exit 1
+ exit_fail "- No profiles matched the found networks"
}
if [[ $(id -u) -ne 0 ]]; then
- err "This script needs to be run with root priviledges"
- exit 1
+ exit_stderr "This script needs to be run with root privileges"
fi
if [[ -z $1 ]]; then
- err "Please supply an interface to connect"
- exit 1
+ exit_stderr "Please supply an interface to connect"
fi
wifi_auto $1
diff --git a/src/globals b/src/globals
index 4e2c397..318c9d9 100644
--- a/src/globals
+++ b/src/globals
@@ -1,8 +1,3 @@
-##################################
-##
-# /usr/lib/network/globals
-##
-##################################
# /etc/network.d/hooks directory
#
diff --git a/src/net-profiles b/src/net-profiles
index 67ab5e8..6c001ea 100644
--- a/src/net-profiles
+++ b/src/net-profiles
@@ -1,13 +1,11 @@
#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
+. /usr/lib/network/globals
case "$1" in
start)
if ! ck_daemon net-profiles; then
- echo "net-profiles has already been started. Try '/etc/rc.d/net-profiles restart'"
- exit
+ exit_stderr "net-profiles has already been started. Try '/etc/rc.d/net-profiles restart'"
fi
# Ensure any device renaming has occurred as intended
@@ -53,7 +51,7 @@ case "$1" in
$0 stop; sleep 1; $0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ exit_stderr "Usage: $0 {start|stop|restart}"
esac
# vim: set ts=4 et sw=4:
diff --git a/src/net-rename b/src/net-rename
index db2c461..25a38ed 100644
--- a/src/net-rename
+++ b/src/net-rename
@@ -1,13 +1,12 @@
#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
+. /usr/lib/network/globals
case "$1" in
start)
- stat_busy "Renaming network devices"
+ report_try "Renaming network devices"
ifrename -p -t
- stat_done
+ report_success
add_daemon net-rename
;;
@@ -20,6 +19,6 @@ case "$1" in
$0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ exit_stderr "Usage: $0 {start|stop|restart}"
esac
# vim: set ts=4 et sw=4:
diff --git a/src/netcfg b/src/netcfg
index 50d9bcf..57d7a74 100644
--- a/src/netcfg
+++ b/src/netcfg
@@ -1,6 +1,5 @@
#!/bin/bash
-. /etc/rc.conf
. /usr/lib/network/network
NETCFG_VER=2.2.1
diff --git a/src/netcfg-menu b/src/netcfg-menu
index 8c58edc..3c800a1 100644
--- a/src/netcfg-menu
+++ b/src/netcfg-menu
@@ -1,7 +1,5 @@
#! /bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
. /usr/lib/network/network
@@ -19,8 +17,7 @@ for prof in `find -L $PROFILE_DIR -maxdepth 1 -type f -printf "%f\n"|sort`; do
done
if [ ${#profiles} -eq 0 ]; then
- echo "No profiles were found in $PROFILE_DIR"
- return 1
+ exit_err "No profiles were found in $PROFILE_DIR"
fi
# if no default yet, use the first entry
@@ -52,7 +49,7 @@ case $ret in
netcfg2 $(cat $ANSWER)
;;
*) # Shouldnt happen
- echo "Abnormal ret code from dialog: $ret"
+ exit_err "Abnormal ret code from dialog: $ret"
;;
esac
rm $ANSWER
diff --git a/src/network b/src/network
index 20ca28e..e7e262a 100644
--- a/src/network
+++ b/src/network
@@ -1,5 +1,6 @@
### Globals
. /usr/lib/network/globals
+# will load hooks and they in turn will load /etc/rc.d/functions if they need to
### Profile loading
##