From 483655a28b0e5a1bc28ddd30bf0c925777ff2dd2 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 21 Sep 2024 13:23:23 -0700 Subject: create-squashfs-snapshot: work on daily snapshots Signed-off-by: Robin H. Johnson --- create-squashfs-snapshot | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/create-squashfs-snapshot b/create-squashfs-snapshot index 4fc35ff..1fafe9d 100755 --- a/create-squashfs-snapshot +++ b/create-squashfs-snapshot @@ -161,6 +161,30 @@ for algo in "${algo_LIST[@]}" ; do ln -s -f "${reponame}-${today}${ext}" "${reponame}-current${ext}" done +# Find the files that do NOT have dated SHA512 checksums with them already. +find . -name 'gentoo-*sqfs' -type f -printf '%f\n' \ +| cut -d. -f1 \ +| uniq \ +| perl -lne 'print $_ unless -f $_.".sha512sum.txt"' \ +| while read _prefix ; do + d=${_prefix}.sha512sum.txt + + find . \ + -name "${prefix}*" \ + -a \( -name "*.sqfs" -o -name '*.sqdelta' \) \ + -printf '%f\n' \ + | xargs sha512sum \ + | gpg --yes -u "${signkeyid}" --clearsign \ + --comment "Daily: ${_prefix}" \ + --output ${d}.tmp \ + /dev/stdin + + mv ${d}.tmp ${d} +done + +# TODO: combine the above checksums (after verification) INSTEAD of +# re-computing checksums on 18GB of data each day. +# # create checksums for snapshot and deltas sha512sum -- *.sqfs *.sqdelta | \ gpg --yes -u "${signkeyid}" --clearsign \ -- cgit v1.2.3-65-gdbad