Store file hashes

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-01-29 16:00:23 +01:00
parent bf1491f800
commit 04d2572376
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -13,8 +13,8 @@ case "${cmd}" in
# Create a new signature file # Create a new signature file
sign) sign)
find /boot -type f -! -name 'files.sig' -exec sha512sum '{}' \; | find /boot -type f -! -name 'files.sig' -! -name 'files.sha512' -exec sha512sum '{}' \; >/boot/files.sha512
gpg --output ${signature_file} --detach-sign gpg --output ${signature_file} --detach-sign /boot/files.sha512
;; ;;
# Verify signature file # Verify signature file
@ -24,8 +24,15 @@ verify)
exit 1 exit 1
} }
find /boot -type f -! -name 'files.sig' -exec sha512sum '{}' \; | find /boot -type f -! -name 'files.sig' -! -name 'files.sha512' -exec sha512sum '{}' \; >/tmp/files.sha512
gpg --verify ${signature_file} - gpg --verify ${signature_file} /tmp/files.sha512 || {
echo
echo '/!\ ATTENTION: SIGNATURE MISMATCH! /!\'
echo
diff -wu /boot/files.sha512 /tmp/files.sha512
exit 1
}
;; ;;
*) *)