Skip to content

Instantly share code, notes, and snippets.

@stigtsp
Last active June 5, 2023 18:23
Show Gist options
  • Save stigtsp/8606830a0b80c941df70c50a4db138d7 to your computer and use it in GitHub Desktop.
Save stigtsp/8606830a0b80c941df70c50a4db138d7 to your computer and use it in GitHub Desktop.
#!/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