fix: Detect device type from machine (#90)

This commit is contained in:
Kroese 2024-05-22 21:17:18 +02:00 committed by GitHub
parent 6e2e6acfd7
commit 08cc4a7cf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View file

@ -6,7 +6,6 @@ set -Eeuo pipefail
BOOT_OPTS=""
BOOT_DESC=""
DRIVER_TYPE="usb"
SECURE=",secure=off"
DIR="/usr/share/qemu"

View file

@ -514,8 +514,17 @@ 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
DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5")
fi

View file

@ -329,7 +329,7 @@ if [[ "$DHCP" == [Yy1]* ]]; then
! checkOS && [[ "$DEBUG" != [Yy1]* ]] && exit 19
if [[ "$IP" == "172."* ]]; then
warn "your IP starts with 172.* which is often a sign that you are not on a macvlan network (required for DHCP)!"
warn "container IP starts with 172.* which is often a sign that you are not on a macvlan network (required for DHCP)!"
fi
# Configuration for DHCP IP