From 1dc6f8d5befb60978823097b98c681126831b3b9 Mon Sep 17 00:00:00 2001 From: Anders Date: Wed, 18 Mar 2020 22:18:14 +0100 Subject: [PATCH] added --size option --- quickemu.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/quickemu.sh b/quickemu.sh index bb0b748..e2253ff 100755 --- a/quickemu.sh +++ b/quickemu.sh @@ -19,7 +19,7 @@ else ram="2G" fi -disk="64G" +disk="64G" # Default unless "--size" is given. xres="1440" yres="900" ver=$(qemu-system-x86_64 -version | head -n1 | cut -d' ' -f4 | cut -d'(' -f1) @@ -70,6 +70,7 @@ function vm_boot() { fi # Boot the iso image + echo "Launching VM." qemu-${ENGINE} \ -cdrom "${iso}" \ -drive "file=${disk_img},format=qcow2,if=virtio,aio=native,cache.direct=on" \ @@ -102,6 +103,7 @@ function usage() { echo " --legacy : Enable legacy BIOS." echo " --restore : Restore the snapshot." echo " --samba : Share your home directory to the guest." + echo " --size : Set vm disk size in GB." echo " --snapshot : Create a disk snapshot." echo " --virgil : Use virgil, if available." exit 1 @@ -138,6 +140,15 @@ while [ $# -gt 0 ]; do echo "WARNING! Requested sharing %{HOME} via samba. 'smbd' not found." fi shift;; + -size|--size) + if ! [[ "$2" =~ ^[0-9]+$ ]]; then + echo "ERROR! Size must be given in numbers only." + exit 1 + fi + echo "Setting disk size to $2GB." + disk="$2" + shift + shift;; -snapshot|--snapshot) SNAPSHOT=1 shift;;