From ce3c1f9ffeffc0b57f46fc21ff1505581d0d199e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 5 Jun 2026 22:51:56 +0300 Subject: Fix tarball cleanup for custom suffixes --- src/photoalbum.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/photoalbum.sh b/src/photoalbum.sh index ae8b01d..afa4ae9 100755 --- a/src/photoalbum.sh +++ b/src/photoalbum.sh @@ -345,11 +345,18 @@ run_with_timeout() { tarball() { local -r tarball_name="$1"; shift + local -r tarball_suffix="${TARBALL_SUFFIX:-.tar}" local base + local old_tarball local -a tar_opts=() - # Cleanup tarball from prev run if any - find "$DIST_DIR" -maxdepth 1 -type f -name '*.tar' -delete + # Cleanup tarballs from previous runs for the configured suffix. + while IFS= read -r -d '' old_tarball; do + if [[ "$old_tarball" == *"$tarball_suffix" ]]; then + rm -f "$old_tarball" + fi + done < <(find "$DIST_DIR" -maxdepth 1 -type f -print0) + base=$(basename "$INCOMING_DIR") resolve_tar_opts tar_opts -- cgit v1.2.3