fix: Don't mount cd-rom when empty (#85)

This commit is contained in:
Kroese 2024-05-21 13:05:59 +02:00 committed by GitHub
parent e40ae8d06c
commit 7d3dc13958
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -505,6 +505,7 @@ addDevice () {
return 0 return 0
} }
DISK_OPTS=""
html "Initializing disks..." html "Initializing disks..."
case "${DISK_TYPE,,}" in case "${DISK_TYPE,,}" in
@ -513,15 +514,19 @@ case "${DISK_TYPE,,}" in
* ) error "Invalid DISK_TYPE, value \"$DISK_TYPE\" is unrecognized!" && exit 80 ;; * ) error "Invalid DISK_TYPE, value \"$DISK_TYPE\" is unrecognized!" && exit 80 ;;
esac esac
[ ! -f "$BOOT" ] || [ ! -s "$BOOT" ] && BOOT="/dev/null" DRIVER_TYPE="usb"
DISK_OPTS=$(addMedia "$BOOT" "$DISK_TYPE" "0" "$BOOT_INDEX" "0x5") MEDIA_TYPE="$DISK_TYPE"
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5")
fi
DRIVERS="/drivers.iso" DRIVERS="/drivers.iso"
[ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso" [ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso"
[ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="/run/drivers.iso" [ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="/run/drivers.iso"
if [ -f "$DRIVERS" ]; then if [ -f "$DRIVERS" ] && [ -s "$DRIVERS" ]; then
DRIVER_OPTS=$(addMedia "$DRIVERS" "usb" "1" "" "0x6") DRIVER_OPTS=$(addMedia "$DRIVERS" "$DRIVER_TYPE" "1" "" "0x6")
DISK_OPTS="$DISK_OPTS $DRIVER_OPTS" DISK_OPTS="$DISK_OPTS $DRIVER_OPTS"
fi fi