Last active
June 5, 2023 18:23
-
-
Save stigtsp/8606830a0b80c941df70c50a4db138d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eux -o pipefail | |
cd /cpan-vol | |
export TZ=UTC | |
START_DATE=$(date -u --iso) | |
START=$(date -u -Iseconds) | |
rsync -va --delete cpan-rsync.perl.org::CPAN /cpan-vol/CPAN/ | |
STOP=$(date -u -Iseconds) | |
# Creating read only snapshot with STOP timestamp | |
btrfs subvolume snapshot -r /cpan-vol/CPAN /cpan-vol/snapshot/CPAN-$STOP | |
# Log checksums of all files separately in a git repository | |
# Updating sha256sums | |
( | |
cd snapshot/CPAN-$STOP | |
find -type f | sort | xargs sha256sum | |
) > log/sha256sums | |
# Committing sha256sums | |
( | |
cd log | |
git commit -m "Updated sha256sums $START_DATE (snapshot=CPAN-$STOP)" sha256sums | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment