grub2-signing-extension/sbin/grub2-sign
2018-01-12 21:46:55 +01:00

37 lines
575 B
Bash
Executable File

#!/bin/bash
# grub2-sign
# Signs everything important in /boot. Depends on grub2-verify.
# Author: Bandie
# Licence: GNU-GPLv3
function sign(){
for f in `find /boot -type f`
do
if gpg --detach-sign $f
then
echo $f signed.
else
return 1
fi
done
return 0
}
# Running grub2-verify first to prevent bad people and double signing
echo "Running grub2-verify to check if everything is unsigned..." >&2
grub2-verify
if (( $? < 2 )); then
echo "Run grub2-unsign first." >&2
exit 1
fi
if ! sign
then
sign
else
echo -e "\nDone!"
fi