diff --git a/quickemu b/quickemu index 2478f7b..1ebe4f8 100755 --- a/quickemu +++ b/quickemu @@ -1164,7 +1164,7 @@ function vm_boot() { else # shellcheck disable=SC2054,SC2206 args+=(-device virtio-blk-pci,drive=SystemDisk - -drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO}) + -drive id=SystemDisk,if=none,format=${disk_format:-qcow2},file="${disk_img}" ${STATUS_QUO}) fi # https://wiki.qemu.org/Documentation/9psetup @@ -1494,6 +1494,7 @@ function monitor_send_cmd { boot="efi" cpu_cores="" disk_img="" +disk_format="" disk_size="" display="" extra_args="" @@ -1784,6 +1785,11 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then disk_size="${disk}" fi + # Set the default disk_format if not provided by user + if [ -z "${disk_format}" ]; then + disk_format=$(${QEMU_IMG} info "${disk_img}" | grep 'file format' | cut -d ':' -f 2 | tr -cd '[:graph:]') + fi + if [ -n "${display}" ]; then OUTPUT="${display}" fi