summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-30 08:56:34 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-30 08:56:34 +0200
commitd7da4b09f7775276231d0241cfe2700d247728ee (patch)
tree4261695c37f457782abea2f3e6cc997921731245 /scripts
parentbda838b0e5e2882b17af0440d85c2c7e079dd892 (diff)
downloadlectio-d7da4b09f7775276231d0241cfe2700d247728ee.tar.gz
lectio-d7da4b09f7775276231d0241cfe2700d247728ee.zip
sources: store the snapshot as one compressed archive
Replace the ~1600 raw per-provider files (24 MB) with a single solid sources/snapshot.tar.gz (6 MB); manifest.tsv + README stay uncompressed for browsing. The extracted per-provider dirs are now git-ignored; snapshot-sources.sh gains pack/unpack, and the README documents the unpack -> refresh -> pack cycle. Distribution-ready: one archive, not a file tree.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/snapshot-sources.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/snapshot-sources.sh b/scripts/snapshot-sources.sh
index e9d6f63..4c8c56c 100755
--- a/scripts/snapshot-sources.sh
+++ b/scripts/snapshot-sources.sh
@@ -11,7 +11,9 @@
# span or add providers by editing the ranges below and re-running.
#
# Usage: sh scripts/snapshot-sources.sh [provider ...]
-# providers: cr litcal getbible missalemeum (default: all)
+# providers: cr litcal getbible missalemeum (default: all four)
+# pack -- roll the fetched dirs into sources/snapshot.tar.gz (committed)
+# unpack -- restore the per-provider dirs from sources/snapshot.tar.gz
set -eu
ROOT=$(cd "$(dirname "$0")/.." && pwd)
@@ -95,6 +97,20 @@ snap_missalemeum() {
done
}
+# The committed artifact is sources/snapshot.tar.gz (the raw per-provider dirs
+# are git-ignored). `pack` rolls the fetched dirs into it; `unpack` restores
+# them from it for a regeneration/audit run.
+pack_archive() {
+ echo "packing sources/snapshot.tar.gz ..."
+ tar czf "$SNAP/snapshot.tar.gz" -C "$SNAP" catholic-resources missalemeum litcal getbible
+ echo " wrote $SNAP/snapshot.tar.gz ($(du -h "$SNAP/snapshot.tar.gz" | cut -f1))"
+}
+unpack_archive() {
+ echo "unpacking sources/snapshot.tar.gz ..."
+ tar xzf "$SNAP/snapshot.tar.gz" -C "$SNAP"
+ echo " extracted per-provider dirs into $SNAP/"
+}
+
which=${*:-cr litcal getbible missalemeum}
for p in $which; do
case "$p" in
@@ -102,6 +118,8 @@ for p in $which; do
litcal) snap_litcal ;;
getbible) snap_getbible ;;
missalemeum) snap_missalemeum ;;
+ pack) pack_archive ;;
+ unpack) unpack_archive ;;
*) echo "unknown provider: $p" >&2 ;;
esac
done