diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2012-04-11 18:04:43 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2012-04-11 18:04:43 +0200 |
commit | 5f708051ba156b5b6d407f02b77e32521b6d449a (patch) | |
tree | 8231ffedecb3f2fa1f315ebd4c0f057695442d88 /scripts | |
parent | 0340759269f84f071b5b7ec11ae4691a8722c21a (diff) | |
download | netctl-5f708051ba156b5b6d407f02b77e32521b6d449a.tar.gz netctl-5f708051ba156b5b6d407f02b77e32521b6d449a.tar.xz |
Fixes to the netcfg daemon
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/netcfg-daemon | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/netcfg-daemon b/scripts/netcfg-daemon index 5a6a6d1..7a662f6 100755 --- a/scripts/netcfg-daemon +++ b/scripts/netcfg-daemon @@ -37,16 +37,21 @@ case "$1" in stop) (( $(id -u) )) && exit_stderr "This script should be run as root." [[ ! -e $STATE_FILE ]] && exit_err "netcfg-daemon was not started" - tac "$STATE_FILE" | while read profile; do - if [[ "$profile" = "${profile#@}" ]]; then - if [[ -e "$STATE_DIR/profiles/$profile" ]]; then - /usr/bin/netcfg down "$profile" || exit 1 + # Stop the profiles in the reverse order they were started. + tac "$STATE_FILE" | ( + while read profile; do + if [[ "$profile" = "${profile#@}" ]]; then + if [[ -e "$STATE_DIR/profiles/$profile" ]]; then + /usr/bin/netcfg down "$profile" || exit $? + fi + else + /usr/bin/netcfg down "${profile#@}" & fi - else - /usr/bin/netcfg down "${profile#@}" & - fi - done - rm -f "$STATE_FILE" + done + rm "$STATE_FILE" + # Generate a return value and make sure we are good to restart. + wait + ) ;; restart) "$0" stop @@ -56,7 +61,7 @@ case "$1" in status) if [[ -e $STATE_FILE ]]; then report_notice "profiles started by netcfg-daemon:" - cat "$STATE_FILE" + sed 's/^@//' "$STATE_FILE" else report_notice "netcfg-daemon was not started" fi |