fix: correctly run VMs when PWD is not relative to the VM directory
This commit is contained in:
parent
5e90e336fe
commit
8c10b20fb7
15
quickemu
15
quickemu
|
@ -52,9 +52,7 @@ function delete_disk() {
|
||||||
rm "${disk_img}" >/dev/null 2>&1
|
rm "${disk_img}" >/dev/null 2>&1
|
||||||
# Remove any EFI vars, but not for macOS
|
# Remove any EFI vars, but not for macOS
|
||||||
rm "${VMDIR}"/OVMF_VARS*.fd >/dev/null 2>&1
|
rm "${VMDIR}"/OVMF_VARS*.fd >/dev/null 2>&1
|
||||||
rm "${VMPATH}/${VMDIR}"/OVMF_VARS*.fd >/dev/null 2>&1
|
|
||||||
rm "${VMDIR}/${VMNAME}-vars.fd" >/dev/null 2>&1
|
rm "${VMDIR}/${VMNAME}-vars.fd" >/dev/null 2>&1
|
||||||
rm "${VMPATH}/${VMDIR}/${VMNAME}-vars.fd" >/dev/null 2>&1
|
|
||||||
echo " - Deleted ${disk_img}"
|
echo " - Deleted ${disk_img}"
|
||||||
delete_shortcut
|
delete_shortcut
|
||||||
else
|
else
|
||||||
|
@ -2058,6 +2056,12 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
||||||
disk_img="${VMDIR}/disk.${disk_format}"
|
disk_img="${VMDIR}/disk.${disk_format}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fixes running VMs when PWD is not relative to the VM directory
|
||||||
|
# https://github.com/quickemu-project/quickemu/pull/875
|
||||||
|
if [ ! -f "${disk_img}" ]; then
|
||||||
|
pushd "${VMPATH}" >/dev/null || exit
|
||||||
|
fi
|
||||||
|
|
||||||
# Iterate over any actions and exit.
|
# Iterate over any actions and exit.
|
||||||
if [ ${#ACTIONS[@]} -ge 1 ]; then
|
if [ ${#ACTIONS[@]} -ge 1 ]; then
|
||||||
for ACTION in "${ACTIONS[@]}"; do
|
for ACTION in "${ACTIONS[@]}"; do
|
||||||
|
@ -2113,13 +2117,6 @@ if [ -r "${VMDIR}/${VMNAME}.pid" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${VM_PID}" ]; then
|
if [ -z "${VM_PID}" ]; then
|
||||||
#TODO: double quote the args array to prevent word splitting and this can be removed
|
|
||||||
# Fix failing to start VM with spaces in the path
|
|
||||||
# https://github.com/quickemu-project/quickemu/pull/875
|
|
||||||
if [ ! -f "${disk_img}" ]; then
|
|
||||||
pushd "${VMPATH}" || exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
vm_boot
|
vm_boot
|
||||||
# If the VM being started is an uninstalled Windows VM then auto-skip the press-any key prompt.
|
# If the VM being started is an uninstalled Windows VM then auto-skip the press-any key prompt.
|
||||||
if [ -n "${iso}" ] && [ "${guest_os}" == "windows" ]; then
|
if [ -n "${iso}" ] && [ "${guest_os}" == "windows" ]; then
|
||||||
|
|
Loading…
Reference in New Issue