chore: clean the output of archive-making

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-08-18 12:31:38 +02:00
parent 414ca4481b
commit 0736b29520
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -1,17 +1,24 @@
#!/bin/sh #!/bin/sh
# remove preexisting archives # remove preexisting archives
echo "[INFO] Removing pre-existing archives"
find ./static/files -name '*.tar.gz' -exec rm {} \; find ./static/files -name '*.tar.gz' -exec rm {} \;
find ./static/files -name '*.tar.bz2' -exec rm {} \; find ./static/files -name '*.tar.bz2' -exec rm {} \;
for relative_path in $(find ./static/files -name '.archive' -print); do for relative_path in $(find ./static/files -name '.archive' -print); do
echo;
relative_path=$(dirname $relative_path) relative_path=$(dirname $relative_path)
base=$(basename $relative_path) base=$(basename $relative_path)
cd $relative_path/.. cd $relative_path/..
all_files=$(find $base/** ! -name '.archive' -print) all_files=$(find $base/** ! -name '.archive' -print)
tar cvaf $base.tar.gz $all_files
tar cvaf $base.tar.bz2 $all_files
cd - echo "[INFO] Compressing $base.tar.gz"
tar caf $base.tar.gz $all_files
echo "[INFO] Compressing $base.tar.bz2"
tar caf $base.tar.bz2 $all_files
cd - &> /dev/null
done; done;