blog/regenerate-archives.sh
Matej Focko a868efaee6
chore: switch to ‹tar› and have consistent paths
* Switch the archiving from the ‹zip› to ‹tar.gz› and ‹tar.bz2›
* Adjust the static files to have consistent paths

Signed-off-by: Matej Focko <me@mfocko.xyz>
2023-08-18 12:19:47 +02:00

17 lines
No EOL
472 B
Bash

#!/bin/sh
# remove preexisting archives
find ./static/files -name '*.tar.gz' -exec rm {} \;
find ./static/files -name '*.tar.bz2' -exec rm {} \;
for relative_path in $(find ./static/files -name '.archive' -print); do
relative_path=$(dirname $relative_path)
base=$(basename $relative_path)
cd $relative_path/..
all_files=$(find $base/** ! -name '.archive' -print)
tar cvaf $base.tar.gz $all_files
tar cvaf $base.tar.bz2 $all_files
cd -
done;