Files
ubuntu-autoinstaller/qemu.sh
Zsolt Alföldi f1221d920f save
2026-03-06 20:38:29 +01:00

30 lines
776 B
Bash
Executable File

set -ex
last_autoinstaller=$(ls -t1 autoinstall-2026* | head -n1)
echo " ....... $last_autoinstaller"
sleep 1
_cdrom=()
if [[ "$1" = "cdrom" ]]; then
_cdrom=(
-drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk
-device usb-ehci,id=usb
-device usb-storage,drive=usbdisk,bus=usb.0,bootindex=1
-bios /usr/share/ovmf/OVMF.fd
)
fi
## Create a virtual disk first
## Uncomment 'create' if test-disk missing
qemu-img create -f qcow2 /tmp/test-disk.qcow2 20G
# Boot the ISO as USB with the virtual disk as install target
qemu-system-x86_64 \
-m 4096 \
-enable-kvm \
-drive file=/tmp/test-disk.qcow2,format=qcow2 \
"${_cdrom[@]}" \
-bios /usr/share/ovmf/OVMF.fd \
-netdev user,id=net0,hostfwd=tcp::12222-:22 \
-device e1000,netdev=net0