Store file hashes
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
bf1491f800
commit
04d2572376
1 changed files with 11 additions and 4 deletions
|
@ -13,8 +13,8 @@ case "${cmd}" in
|
|||
|
||||
# Create a new signature file
|
||||
sign)
|
||||
find /boot -type f -! -name 'files.sig' -exec sha512sum '{}' \; |
|
||||
gpg --output ${signature_file} --detach-sign
|
||||
find /boot -type f -! -name 'files.sig' -! -name 'files.sha512' -exec sha512sum '{}' \; >/boot/files.sha512
|
||||
gpg --output ${signature_file} --detach-sign /boot/files.sha512
|
||||
;;
|
||||
|
||||
# Verify signature file
|
||||
|
@ -24,8 +24,15 @@ verify)
|
|||
exit 1
|
||||
}
|
||||
|
||||
find /boot -type f -! -name 'files.sig' -exec sha512sum '{}' \; |
|
||||
gpg --verify ${signature_file} -
|
||||
find /boot -type f -! -name 'files.sig' -! -name 'files.sha512' -exec sha512sum '{}' \; >/tmp/files.sha512
|
||||
gpg --verify ${signature_file} /tmp/files.sha512 || {
|
||||
echo
|
||||
echo '/!\ ATTENTION: SIGNATURE MISMATCH! /!\'
|
||||
echo
|
||||
diff -wu /boot/files.sha512 /tmp/files.sha512
|
||||
|
||||
exit 1
|
||||
}
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
Loading…
Reference in a new issue