summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-02-24 18:34:12 +0100
committerErich Eckner <git@eckner.net>2021-02-24 18:34:12 +0100
commit10ec52b36c2cee277cac1c2cb84ca8bd66a9942e (patch)
tree30e3489612c3ecf0b3468a6760a6f34faa2f7e6a /bin
parent4d6471b0c9a423a375557541ed45ab2588fc8e55 (diff)
downloadbuilder-10ec52b36c2cee277cac1c2cb84ca8bd66a9942e.tar.xz
bin/build-packages: remove left-over *.pkg.tar.zst if compression failed
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-packages7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/build-packages b/bin/build-packages
index 512c684..eebf8c8 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -682,10 +682,15 @@ while [ "${count}" -ne 0 ] && \
# silently fall back to lower compression levels if the higher
# level fails.
+ # beware: We must remove *.pkg.tar.zst after failed
+ # compression attempts, otherwise future compression attempts
+ # will refuse to overwrite them.
+
# shellcheck disable=SC2086
for options in '-T0 --ultra -20' '--ultra -20' {-19..-3}; do
find . -maxdepth 1 -type f -name '*.pkg.tar' \
- -execdir zstd --rm ${options} '{}' -o '{}.zst' \;
+ -not -execdir zstd --rm ${options} '{}' -o '{}.zst' \; \
+ -exec rm -f '{}.zst' \;
done
# package files, that still exist, threw an error upon compression
errors=$(