From 4ebad5f88abda1b0788ef7ad3cd46d8cd8cfa6d7 Mon Sep 17 00:00:00 2001 From: James Rayner Date: Mon, 10 Aug 2009 21:25:09 +1000 Subject: Erase any suspended profiles on a newly connected interface --- src/network | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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 $? -- cgit v1.2.3-24-g4f1b