added --size option

This commit is contained in:
Anders 2020-03-18 22:18:14 +01:00
parent c1ca4908d5
commit 1dc6f8d5be
1 changed files with 12 additions and 1 deletions

View File

@ -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;;