33 lines
765 B
Plaintext
Raw Normal View History

2015-03-16 20:38:36 +01:00
#!/bin/bash
# grub2-unsign
# Unsigns every file in /boot. Depends on grub2-verify
# Author: Bandie
2015-03-16 20:38:36 +01:00
# Licence: GNU-GPLv3
2015-03-17 07:23:23 +01:00
# Check if something is wrong
2020-01-08 17:54:57 +01:00
grub-verify
2018-03-22 13:34:56 +01:00
stat=$?
2019-02-17 10:13:22 +01:00
case "$stat" in
1)
printf '%s\n' "grub2-verify has detected a one or more bad signatures." "Please check for malicious software before you're unsigning everything!" >&2
exit 1
2019-02-17 10:13:22 +01:00
;;
2)
2018-03-22 13:34:56 +01:00
printf 'Everything is unsigned already.\n'
exit 0
2019-02-17 10:13:22 +01:00
;;
3)
2018-03-22 13:34:56 +01:00
printf 'Ignoring missing signatures...\n'
2019-02-17 10:13:22 +01:00
;&
0|3)
2018-04-08 14:46:43 +02:00
# Then remove the signatures.
2018-08-05 21:35:41 +02:00
find /boot -name '*.sig' -exec rm {} +
2018-04-08 14:46:43 +02:00
echo "GRUB2 unsigned. WARNING: If you want to deactivate GRUB2's signature feature, change the check_signatures variable in the headers file!"
exit 0
2019-02-17 10:13:22 +01:00
;;
*)
2018-03-22 13:34:56 +01:00
printf 'Something unknown happened!\n'
exit 99
2019-02-17 10:13:22 +01:00
esac