From e964612ae7a6fc8bb8ec14e48149a550ce2cafaf Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 2 Dec 2020 19:25:18 -0600 Subject: [PATCH] Turns out openssl dgst doesn't actually check digest files --- gentoostrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gentoostrap.sh b/gentoostrap.sh index dd20df3..b649ffa 100755 --- a/gentoostrap.sh +++ b/gentoostrap.sh @@ -110,12 +110,12 @@ build-gentoo() { if ! [ -f "$stage3file" ]; then log "Downloading stage3" curl -s "$stage3" -o "$stage3file" - elif ! openssl dgst -r -sha512 "$stage3file"; then + elif ! grep -e "$(sha512sum "$stage3file" | awk '{print $1}')"; then log "Checksum verification failed; downloading new stage3" curl -s "$stage3" -o "$stage3file" fi # At this point, we should have a new stage3 that matches our signature; die of not - if ! openssl dgst -r -sha512 "$stage3file"; then + if ! grep -e "$(sha512sum "$stage3file" | awk '{print $1}')"; then error "stage3 checksum verification failed" 50 fi log "Decompressing tarball; this will prompt for root privileges"