mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Refactor initial disk creation and boot order
This commit is contained in:
parent
510c2e0525
commit
38307c1c0f
1 changed files with 5 additions and 12 deletions
17
quickemu
17
quickemu
|
@ -61,6 +61,7 @@ function vm_boot() {
|
|||
fi
|
||||
|
||||
readonly disk_min_size=395264
|
||||
local disk_curr_size=$(stat -c%s "${disk_img}")
|
||||
if [ -z "${disk}" ]; then
|
||||
disk="64G"
|
||||
fi
|
||||
|
@ -81,24 +82,16 @@ function vm_boot() {
|
|||
fi
|
||||
|
||||
echo " - Disk: ${disk_img} (${disk})"
|
||||
# If the disk is present but doesn't appear to have an install, then
|
||||
# remove it.
|
||||
if [ -e ${disk_img} ]; then
|
||||
local disk_curr_size=$(stat -c%s "${disk_img}")
|
||||
if [ ${disk_curr_size} -le ${disk_min_size} ]; then
|
||||
echo " Looks unused, recreating."
|
||||
rm "${disk_img}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${disk_img}" ]; then
|
||||
if [ -e ${disk_img} ] && [ ${disk_curr_size} -le ${disk_min_size} ]; then
|
||||
echo " Looks unused, booting from ${iso}"
|
||||
elif [ ! -f "${disk_img}" ]; then
|
||||
# If there is no disk image, create a new image.
|
||||
${QEMU_IMG} create -q -f qcow2 "${disk_img}" "${disk}"
|
||||
echo " Just created, booting from ${iso}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR! Failed to create ${disk_img} of ${disk}. Stopping here."
|
||||
exit 1
|
||||
fi
|
||||
echo " - ISO: ${iso}"
|
||||
else
|
||||
# If there is a disk image, do not boot from the iso
|
||||
iso=""
|
||||
|
|
Loading…
Reference in a new issue