aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2024-09-22 22:00:37 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2024-09-22 22:00:37 -0700
commit7e894f8def0e29f3e7868d7c214387b6174acf44 (patch)
tree04367e9d8d182ab9da8640df1e71c0d6401f4bf5
parentcreate-squashfs-snapshot: shellcheck fixes (diff)
downloadmastermirror-scripts-7e894f8def0e29f3e7868d7c214387b6174acf44.tar.gz
mastermirror-scripts-7e894f8def0e29f3e7868d7c214387b6174acf44.tar.bz2
mastermirror-scripts-7e894f8def0e29f3e7868d7c214387b6174acf44.zip
create-squashfs-snapshot: sort checksum files to avoid flaps20240923T050040Z
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xcreate-squashfs-snapshot11
1 files changed, 8 insertions, 3 deletions
diff --git a/create-squashfs-snapshot b/create-squashfs-snapshot
index 8989d46..aa4bc4e 100755
--- a/create-squashfs-snapshot
+++ b/create-squashfs-snapshot
@@ -26,6 +26,7 @@
shopt -s nullglob
set -e -x
+date +%s.%N
# == config ==
# filled with gentoo-specific details, change at will
@@ -163,8 +164,10 @@ done
# create checksums for snapshot and deltas
# OLD LOGIC, that scans entire 18GB
-sha512sum -- *.sqfs *.sqdelta | \
- gpg \
+ls -d -- *.sqfs *.sqdelta \
+| xargs sha512sum -- \
+| sort -k +2 \
+| gpg \
--batch \
--yes \
-u "${signkeyid}" \
@@ -198,6 +201,7 @@ sign_prefix() {
# exist.
find . -maxdepth 1 -mindepth 1 -name 'gentoo-*sqfs' -type f -printf '%f\n' \
| cut -d. -f1 \
+| sort \
| uniq \
| perl -lne 'print $_ unless -e $_.".sha512sum.txt"' \
| while read -r _prefix ; do
@@ -234,8 +238,8 @@ done
# 4. Combine the verified files and sign the combined output.
find "$tempdir" -name 'gentoo-*combine-verified' \
- | sort \
| xargs --no-run-if-empty cat \
+ | sort -k +2 \
| gpg \
--batch \
--yes \
@@ -246,3 +250,4 @@ find "$tempdir" -name 'gentoo-*combine-verified' \
/dev/stdin
mv "${tempdir}"/{sha512sum.txt.tmp,sha512sum.txt}
diff -Nuar sha512sum.txt "${tempdir}"/sha512sum.txt
+date +%s.%N