fix: Do not ignore unrecognized bootmodes (#96)

This commit is contained in:
Kroese 2024-05-26 13:34:43 +02:00 committed by GitHub
parent 7234632a74
commit 9eb0b703f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 16 deletions

View file

@ -130,7 +130,7 @@ kubectl apply -f kubernetes.yml
* ### How do I change the amount of CPU or RAM?
By default, the container is allowed to use a maximum of 1 CPU core and 1 GB of RAM.
By default, the container will be allowed to use a maximum of 1 CPU core and 1 GB of RAM.
If you want to adjust this, you can specify the desired amount using the following environment variables:

View file

@ -33,10 +33,8 @@ case "${BOOT_MODE,,}" in
BOOT_OPTS="-rtc base=localtime"
;;
*)
info "Unknown boot mode '${BOOT_MODE}', defaulting to 'uefi'"
BOOT_MODE="uefi"
ROM="AAVMF_CODE.no-secboot.fd"
VARS="AAVMF_VARS.fd"
error "Unknown BOOT_MODE, value \"${BOOT_MODE}\" is not recognized!"
exit 33
;;
esac

View file

@ -514,25 +514,22 @@ case "${DISK_TYPE,,}" in
* ) error "Invalid DISK_TYPE, value \"$DISK_TYPE\" is unrecognized!" && exit 80 ;;
esac
DRIVER_TYPE="ide"
MEDIA_TYPE="$DISK_TYPE"
case "${MACHINE,,}" in
"virt" )
DRIVER_TYPE="usb" ;;
"pc-q35-2"* )
DISK_TYPE="blk"
MEDIA_TYPE="ide" ;;
esac
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
MEDIA_TYPE="$DISK_TYPE"
if [ -z "${BOOT_MODE:-}" ] || [[ "${BOOT_MODE:-}" == *"legacy" ]]; then
if [[ "${MACHINE,,}" != "virt" ]] && [[ "${MEDIA_TYPE,,}" == "blk" ]]; then
MEDIA_TYPE="ide"
fi
fi
DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5")
fi
DRIVER_TYPE="ide"
DRIVERS="/drivers.iso"
[ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso"
if [ -f "$DRIVERS" ] && [ -s "$DRIVERS" ]; then
[[ "${MACHINE,,}" == "virt" ]] && DRIVER_TYPE="usb"
DRIVER_OPTS=$(addMedia "$DRIVERS" "$DRIVER_TYPE" "1" "" "0x6")
DISK_OPTS="$DISK_OPTS $DRIVER_OPTS"
fi
@ -609,4 +606,5 @@ fi
DISK_OPTS="$DISK_OPTS -object iothread,id=io2"
html "Initialized disks successfully..."
return 0