fix: Verify ROM data is not empty
This commit is contained in:
parent
f6b099a555
commit
88fd998555
1 changed files with 6 additions and 4 deletions
10
src/boot.sh
10
src/boot.sh
|
|
@ -38,14 +38,16 @@ fi
|
||||||
AAVMF="/usr/share/AAVMF/"
|
AAVMF="/usr/share/AAVMF/"
|
||||||
DEST="$STORAGE/${BOOT_MODE,,}"
|
DEST="$STORAGE/${BOOT_MODE,,}"
|
||||||
|
|
||||||
if [ ! -f "$DEST.rom" ]; then
|
if [ ! -s "$DEST.rom" ]; then
|
||||||
[ ! -f "$AAVMF/$ROM" ] && error "UEFI boot file ($AAVMF/$ROM) not found!" && exit 44
|
[ ! -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=/dev/zero "of=$DEST.rom" bs=1M count=64 status=none
|
||||||
dd "if=$AAVMF/$ROM" "of=$DEST.rom" conv=notrunc status=none
|
dd "if=$AAVMF/$ROM" "of=$DEST.rom" conv=notrunc status=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$DEST.vars" ]; then
|
if [ ! -s "$DEST.vars" ]; then
|
||||||
[ ! -f "$AAVMF/$VARS" ] && error "UEFI vars file ($AAVMF/$VARS) not found!" && exit 45
|
[ ! -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=/dev/zero "of=$DEST.vars" bs=1M count=64 status=none
|
||||||
dd "if=$AAVMF/$VARS" "of=$DEST.vars" conv=notrunc status=none
|
dd "if=$AAVMF/$VARS" "of=$DEST.vars" conv=notrunc status=none
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue