From e566e38e9cb10ff8a09c5fad9dc468e28065de9b Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Sat, 21 Mar 2020 10:29:48 +0000 Subject: [PATCH] Catch missing iso with non-bootable disk scenario --- quickemu | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickemu b/quickemu index b631dbf..59c04e8 100755 --- a/quickemu +++ b/quickemu @@ -115,8 +115,12 @@ function vm_boot() { echo " - Disk: ${disk_img} (${disk})" if [ ! -f "${disk_img}" ]; then - # If there is no disk image, create a new image. + # If there is no disk image, create a new image. ${QEMU_IMG} create -q -f qcow2 "${disk_img}" "${disk}" + if [ -z "${iso}" ]; then + echo "ERROR! You haven't specified a .iso image to boot from." + exit 1 + fi echo " Just created, booting from ${iso}" if [ $? -ne 0 ]; then echo "ERROR! Failed to create ${disk_img} of ${disk}. Stopping here." @@ -132,6 +136,10 @@ function vm_boot() { disk_curr_size=$(stat -c%s "${disk_img}") if [ ${disk_curr_size} -le ${disk_min_size} ]; then echo " Looks unused, booting from ${iso}" + if [ -z "${iso}" ]; then + echo "ERROR! You haven't specified a .iso image to boot from." + exit 1 + fi else # If there is a disk image, that appears to have an install # then do not boot from the iso