diff options
author | Jim Pryor <profjim@jimpryor.net> | 2009-08-11 14:05:05 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-08-15 04:28:28 +0200 |
commit | b7d6f5afb02d5567c572149d5b6469c77980cc24 (patch) | |
tree | da9ac9cc8279f280b4198b825a9903b75bbc2e62 /src-wireless/net-auto | |
parent | 8f9a77369c89db4de7d50d058b63c6b47a3428c9 (diff) | |
download | netctl-b7d6f5afb02d5567c572149d5b6469c77980cc24.tar.gz netctl-b7d6f5afb02d5567c572149d5b6469c77980cc24.tar.xz |
net-auto daemon file? already started?
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src-wireless/net-auto')
-rw-r--r-- | src-wireless/net-auto | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src-wireless/net-auto b/src-wireless/net-auto index 3f74ffc..c1e9d70 100644 --- a/src-wireless/net-auto +++ b/src-wireless/net-auto @@ -4,6 +4,9 @@ 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#!}" -a "$daemon" = "net-rename" ]; then @@ -14,21 +17,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 [[ "$auto" ]]; then - /usr/bin/netcfg-$auto $iface - [[ $? -eq 0 ]] && echo $iface >> /var/run/daemons/net-auto + if /usr/bin/netcfg-"$auto" "$iface"; then + echo "$iface" >> "$STATE_DIR/net-auto" + add_daemon net-auto # JP: was this forgotten? + fi unset auto fi done ;; stop) - [[ ! -e /var/run/daemons/net-auto ]] && exit 0 - for iface in $(cat /var/run/daemons/net-auto); do + if ck_daemon net-auto; then + exit_stderr "net-auto not running" + fi + + for iface in $(cat "$STATE_DIR/net-auto"); do netcfg iface-down $iface done + rm -f "$STATE_DIR/net-auto" rm_daemon net-auto ;; restart) |