summaryrefslogtreecommitdiffstats
path: root/src-wireless/net-auto
diff options
context:
space:
mode:
Diffstat (limited to 'src-wireless/net-auto')
-rw-r--r--src-wireless/net-auto43
1 files changed, 12 insertions, 31 deletions
diff --git a/src-wireless/net-auto b/src-wireless/net-auto
index 98bb91d..8b724a5 100644
--- a/src-wireless/net-auto
+++ b/src-wireless/net-auto
@@ -2,16 +2,12 @@
. /etc/rc.conf
. /etc/rc.d/functions
-. /usr/lib/network/globals
case "$1" in
start)
- if ! ck_daemon net-auto; then # JP: check if it's already running
- exit_stderr "net-auto has already been started: try \"/etc/rc.d/net-auto restart\""
- fi
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [[ "$daemon" = "${daemon#!}" && "$daemon" = net-rename ]]; then
+ if [ "$daemon" = "${daemon#!}" -a "$daemon" = "net-rename" ]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi
@@ -19,43 +15,28 @@ case "$1" in
done
# TODO: check if any way of using 'stacks' in bash
-
- rm -f "$STATE_DIR/net-auto"
- for iface in "${AUTO_NETWORKS[@]}"; do
- if [[ "${iface:0:4}" = auto ]]; then
- auto="$iface"
- elif [[ -n "$auto" ]]; then
- if /usr/bin/netcfg-"$auto" "$iface"; then
- echo "$iface" >> "$STATE_DIR/net-auto"
- add_daemon net-auto # JP: was this forgotten?
- fi
+ for iface in ${AUTO_NETWORKS[@]}; do
+ if [[ "${iface:0:4}" = "auto" ]]; then
+ auto=$iface
+ elif [[ "$auto" ]]; then
+ /usr/bin/netcfg-$auto $iface
+ [[ $? -eq 0 ]] && echo $iface >> /var/run/daemons/net-auto
unset auto
- else
- true # JP: can AUTO_NETWORKS contain elements other than ...auto-CONNECTION INTERFACE...?
- # JP: for example, what do we do with AUTO_NETWORKS=(auto-wireless wlan0 eth0)?
- # JP: or with AUTO_NETWORKS=(eth0 auto-wireless wlan0)?
fi
done
;;
stop)
- if ck_daemon net-auto; then
- exit_stderr "net-auto not running"
- fi
-
- for iface in $(cat "$STATE_DIR/net-auto"); do # JP: note that we may have written "wlan0 wlan1" to net-auto
- # e.g. if the user did AUTO_NETWORKS=(auto-wireless "wlan0 wlan1")
- # and now we're unpacking and handling wlan0, wlan1 one by one
- # that's not necessarily a problem...I'm just calling attention to it
- /usr/bin/netcfg iface-down "$iface"
+ [[ ! -e /var/run/daemons/net-auto ]] && exit 0
+ for iface in $(cat /var/run/daemons/net-auto); do
+ netcfg iface-down $iface
done
- rm -f "$STATE_DIR/net-auto"
rm_daemon net-auto
;;
restart)
- "$0" stop; sleep 1; "$0" start
+ $0 stop; sleep 1; $0 start
;;
*)
- exit_stderr "Usage: $0 {start|stop|restart}"
+ echo "usage: $0 {start|stop|restart}"
esac
# vim: set ts=4 et sw=4: