summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2024-07-16 09:09:13 +0200
committerLinus Färnstrand <linus@mullvad.net>2024-07-16 11:15:24 +0200
commit19b90ab93b4fec575c0f840e16b329e6d70bc9e6 (patch)
tree2ee1502631d039cb2bded3cfdbb0c2c28ce24615
parent48c52b8895dc468e833d5fa74791d3902b64fd01 (diff)
downloadmullvadvpn-19b90ab93b4fec575c0f840e16b329e6d70bc9e6.tar.xz
mullvadvpn-19b90ab93b4fec575c0f840e16b329e6d70bc9e6.zip
Clean up browser download tmp dir with a trap
Makes sure it's deleted even if the script dies prematurely
-rwxr-xr-xci/mullvad-browser/download-mullvad-browser.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/ci/mullvad-browser/download-mullvad-browser.sh b/ci/mullvad-browser/download-mullvad-browser.sh
index 460b1ee37b..659a41313b 100755
--- a/ci/mullvad-browser/download-mullvad-browser.sh
+++ b/ci/mullvad-browser/download-mullvad-browser.sh
@@ -84,6 +84,11 @@ fi
pushd "$TMP_DIR" > /dev/null
+function delete_tmp_dir {
+ echo "[#] Exiting and deleting $TMP_DIR"
+ rm -rf "$TMP_DIR"
+}
+trap 'delete_tmp_dir' EXIT
echo "[#] Configured releases are: ${BROWSER_RELEASES[*]}"
@@ -108,6 +113,3 @@ for repository in "${REPOSITORIES[@]}"; do
echo "[#] Notifying $repository_notify_file"
echo "$REPOSITORY_TMP_ARTIFACT_DIR" > "$repository_notify_file"
done
-
-# Remove our temporary working directory
-rm -r "$TMP_DIR"