From 4177e4b48417589d7f37026a83534ed47e4767be Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 21 May 2024 13:03:53 +0200 Subject: [PATCH] fix: Don't mount cd-rom when empty --- src/disk.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/disk.sh b/src/disk.sh index aec2adc..50bd719 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -505,6 +505,7 @@ addDevice () { return 0 } +DISK_OPTS="" html "Initializing disks..." case "${DISK_TYPE,,}" in @@ -513,15 +514,19 @@ case "${DISK_TYPE,,}" in * ) error "Invalid DISK_TYPE, value \"$DISK_TYPE\" is unrecognized!" && exit 80 ;; esac -[ ! -f "$BOOT" ] || [ ! -s "$BOOT" ] && BOOT="/dev/null" -DISK_OPTS=$(addMedia "$BOOT" "$DISK_TYPE" "0" "$BOOT_INDEX" "0x5") +DRIVER_TYPE="usb" +MEDIA_TYPE="$DISK_TYPE" + +if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then + DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5") +fi DRIVERS="/drivers.iso" [ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso" [ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="/run/drivers.iso" -if [ -f "$DRIVERS" ]; then - DRIVER_OPTS=$(addMedia "$DRIVERS" "usb" "1" "" "0x6") +if [ -f "$DRIVERS" ] && [ -s "$DRIVERS" ]; then + DRIVER_OPTS=$(addMedia "$DRIVERS" "$DRIVER_TYPE" "1" "" "0x6") DISK_OPTS="$DISK_OPTS $DRIVER_OPTS" fi