2023-08-18 12:19:47 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# remove preexisting archives
|
2023-08-18 12:31:38 +02:00
|
|
|
echo "[INFO] Removing pre-existing archives"
|
2023-08-18 12:19:47 +02:00
|
|
|
find ./static/files -name '*.tar.gz' -exec rm {} \;
|
|
|
|
find ./static/files -name '*.tar.bz2' -exec rm {} \;
|
|
|
|
|
2023-09-07 19:45:10 +02:00
|
|
|
ROOT_DIR=$PWD
|
|
|
|
|
2023-08-18 12:19:47 +02:00
|
|
|
for relative_path in $(find ./static/files -name '.archive' -print); do
|
2023-08-18 12:31:38 +02:00
|
|
|
echo;
|
|
|
|
|
2023-08-18 12:19:47 +02:00
|
|
|
relative_path=$(dirname $relative_path)
|
|
|
|
base=$(basename $relative_path)
|
|
|
|
cd $relative_path/..
|
|
|
|
|
|
|
|
all_files=$(find $base/** ! -name '.archive' -print)
|
|
|
|
|
2023-08-18 12:31:38 +02:00
|
|
|
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
|
|
|
|
|
2023-09-07 19:45:10 +02:00
|
|
|
cd $ROOT_DIR
|
2023-08-18 12:19:47 +02:00
|
|
|
done;
|