diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/snapshot-sources.sh | 20 |
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 |
