From 5ad41d45db12399908e2342ba70ef6e865fb9aca Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 18 Feb 2025 14:57:58 +0100 Subject: [PATCH] packages: add a trap to cleanup after snapshot script --- scripts/packaging/octez/scripts/snapshot-import.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/packaging/octez/scripts/snapshot-import.sh b/scripts/packaging/octez/scripts/snapshot-import.sh index 9ad0d51f2604..c0cb229dbcec 100755 --- a/scripts/packaging/octez/scripts/snapshot-import.sh +++ b/scripts/packaging/octez/scripts/snapshot-import.sh @@ -55,6 +55,9 @@ while [ "$#" -gt 0 ]; do esac done +# Set up a trap to remove the file on error (non-zero exit status) +trap 'rm -f /tmp/$HISTORY_MODE' EXIT + # We need access to the config.json as the tezos user. # We simply check if the config file exist. But we don't # try to update the octez node configuration. Trying to @@ -70,6 +73,7 @@ fi # Commands execution echo "Downloading snapshot for network: $NETWORK, history mode: $HISTORY_MODE..." +rm -f "/tmp/$HISTORY_MODE" curl -s -o "/tmp/$HISTORY_MODE" "https://snapshots.tzinit.org/$NETWORK/$HISTORY_MODE" echo "Importing snapshot with option: $SNAPSHOT_NO_CHECK..." -- GitLab