kernelsign

kernel signing script for UEFI Secure Boot
git clone git://xn--q9jzb1c.xn--q9jyb4c/kernelsign
Log | Files | Refs | README | LICENSE

commit 72721fe7c3f85cb5f08f414eeb82ecff6a17052b
parent b50250728f467edbf91dc57264c37a638ccdd89b
Author: nanmi <nanmi@member.fsf.org>
Date:   Fri, 16 Dec 2022 02:24:52 +0900

Check for bzImage before backup

Diffstat:
Mks.sh | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ks.sh b/ks.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# Kernelsign v0.1.0 +# Kernelsign v0.1.1 set -eu # To find the UUIDs, run `lsblk -f` as root @@ -20,6 +20,11 @@ _text() { printf " ${INSTALL}*${GENTOO} %s\n" "${*}" } +_backupKernel() { + _text "Backing up old kernel at ${MNT}..." + mv -uv "${ESP}/bzImage.efi" "${MNT}/bzImage.efi.old" +} + prepareKeys() { _text "Opening keys partition as ${NAME}..." cryptsetup -v luksOpen UUID="${KEYS_UUID}" "${NAME}" @@ -30,8 +35,7 @@ prepareKeys() { prepareESP() { _text "Mounting ESP..." mount -vU "${ESP_UUID}" "${ESP}" - _text "Backing up old kernel at ${MNT}..." - mv -uv "${ESP}/bzImage.efi" "${MNT}/oldbzImage.efi" + [ -s "${ESP}/bzImage.efi" ] && _backupKernel } signKernel() {