fix: Detect device type from machine (#90)
This commit is contained in:
parent
6e2e6acfd7
commit
08cc4a7cf1
3 changed files with 10 additions and 2 deletions
|
@ -6,7 +6,6 @@ set -Eeuo pipefail
|
||||||
|
|
||||||
BOOT_OPTS=""
|
BOOT_OPTS=""
|
||||||
BOOT_DESC=""
|
BOOT_DESC=""
|
||||||
DRIVER_TYPE="usb"
|
|
||||||
SECURE=",secure=off"
|
SECURE=",secure=off"
|
||||||
DIR="/usr/share/qemu"
|
DIR="/usr/share/qemu"
|
||||||
|
|
||||||
|
|
|
@ -514,8 +514,17 @@ 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
|
||||||
|
|
||||||
|
DRIVER_TYPE="ide"
|
||||||
MEDIA_TYPE="$DISK_TYPE"
|
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
|
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
|
||||||
DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5")
|
DISK_OPTS=$(addMedia "$BOOT" "$MEDIA_TYPE" "0" "$BOOT_INDEX" "0x5")
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -329,7 +329,7 @@ if [[ "$DHCP" == [Yy1]* ]]; then
|
||||||
! checkOS && [[ "$DEBUG" != [Yy1]* ]] && exit 19
|
! checkOS && [[ "$DEBUG" != [Yy1]* ]] && exit 19
|
||||||
|
|
||||||
if [[ "$IP" == "172."* ]]; then
|
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
|
fi
|
||||||
|
|
||||||
# Configuration for DHCP IP
|
# Configuration for DHCP IP
|
||||||
|
|
Loading…
Reference in a new issue