summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-08-10 13:25:09 +0200
committerJames Rayner <james@archlinux.org>2009-08-10 13:25:09 +0200
commit4ebad5f88abda1b0788ef7ad3cd46d8cd8cfa6d7 (patch)
treef7fd187ec1f7bdaaf03481c4eb189fe998811572 /src/network
parent2e0f6bf77d69334e44e890980a671b7c5b4f39b1 (diff)
downloadnetctl-4ebad5f88abda1b0788ef7ad3cd46d8cd8cfa6d7.tar.gz
netctl-4ebad5f88abda1b0788ef7ad3cd46d8cd8cfa6d7.tar.xz
Erase any suspended profiles on a newly connected interface
Diffstat (limited to 'src/network')
-rw-r--r--src/network13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network b/src/network
index 07fb86c..20ca28e 100644
--- a/src/network
+++ b/src/network
@@ -115,6 +115,19 @@ profile_up()
set_profile up $1
unset EXCLUSIVE
+
+ # Successfully running a new profile; erase any suspended profiles on this interface
+ local iface="$INTERFACE"
+ find "$STATE_DIR/suspend/" -maxdepth 1 -type f -printf '%f\n' \
+ | while read prof; do
+ # the pipe to "while read" will create a subshell, so sourced variables will already be in a sandbox
+ # we just need to clear INTERFACE which is all we care about
+ unset INTERFACE
+ . "$STATE_DIR/suspend/$prof"
+ if [[ "$iface" == "$INTERFACE" ]]; then
+ rm "$STATE_DIR/suspend/$prof"
+ fi
+ done
report_success
); return $?