From 88fd998555efb840976b8d9caa4f398822e58e07 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 16 Apr 2024 14:55:37 +0200 Subject: [PATCH] fix: Verify ROM data is not empty --- src/boot.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/boot.sh b/src/boot.sh index 1e1bee7..f9e62b3 100644 --- a/src/boot.sh +++ b/src/boot.sh @@ -38,14 +38,16 @@ fi AAVMF="/usr/share/AAVMF/" DEST="$STORAGE/${BOOT_MODE,,}" -if [ ! -f "$DEST.rom" ]; then - [ ! -f "$AAVMF/$ROM" ] && error "UEFI boot file ($AAVMF/$ROM) not found!" && exit 44 +if [ ! -s "$DEST.rom" ]; then + [ ! -s "$AAVMF/$ROM" ] && error "UEFI boot file ($AAVMF/$ROM) not found!" && exit 44 + rm -f "$DEST.rom" dd if=/dev/zero "of=$DEST.rom" bs=1M count=64 status=none dd "if=$AAVMF/$ROM" "of=$DEST.rom" conv=notrunc status=none fi -if [ ! -f "$DEST.vars" ]; then - [ ! -f "$AAVMF/$VARS" ] && error "UEFI vars file ($AAVMF/$VARS) not found!" && exit 45 +if [ ! -s "$DEST.vars" ]; then + [ ! -s "$AAVMF/$VARS" ] && error "UEFI vars file ($AAVMF/$VARS) not found!" && exit 45 + rm -f "$DEST.vars" dd if=/dev/zero "of=$DEST.vars" bs=1M count=64 status=none dd "if=$AAVMF/$VARS" "of=$DEST.vars" conv=notrunc status=none fi