Merge pull request #337 from shinji-s/adhoc_fix

Fix exception from install_path() and other enhancements
pull/343/head
multibootusb 6 years ago committed by GitHub
commit ac103c3504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,7 @@ def resource_path(relativePath):
#basePath = os.path.abspath(".")
basePath = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
for dir_ in [basePath, os.path.abspath('.'), os.path.abspath('..')]:
for dir_ in [os.path.abspath('.'), os.path.abspath('..'), basePath]:
fullpath = os.path.join(dir_, relativePath)
if os.path.exists(fullpath):
return fullpath

@ -221,10 +221,13 @@ def install_patch():
This is required to make sure that same version (32/64 bit) of modules present is the isolinux directory
:return:
"""
isobin_path = isolinux_bin_path(config.image_path)
if not isobin_path:
return
iso_cfg_ext_dir = os.path.join(multibootusb_host_dir(),
"iso_cfg_ext_dir")
isolinux_path = os.path.join(iso_cfg_ext_dir,
isolinux_bin_path(config.image_path))
isolinux_path = os.path.join(iso_cfg_ext_dir, isobin_path)
# iso_linux_bin_dir = isolinux_bin_dir(config.image_path)
distro_install_dir = os.path.join(
config.usb_mount, "multibootusb", iso_basename(config.image_path))

@ -76,32 +76,36 @@ class Qemu(QtWidgets.QMainWindow, Ui_MainWindow):
log("ERROR: USB Boot: qemu not found!")
QtWidgets.QMessageBox.information(self, 'No QEMU...', 'Please install qemu to use this feature.')
else:
options = []
ram = self.qemu_usb_ram()
if ram:
ram = " -m " + ram
else:
ram = ""
haxm = (hasattr(config, 'qemu_use_haxm') and \
config.qemu_use_haxm) and ' -accel hax' or ''
options.extend(['-m', ram])
if getattr(config, 'qemu_use_haxm', False):
options.extend(['-accel', 'hax'])
bios = getattr(config, 'qemu_bios', None)
if bios:
options.extend(['-bios', bios])
optstr = (' ' + ' '.join(options)) if options else ''
if platform.system() == "Windows":
disk_number = get_physical_disk_number(qemu_usb_disk)
qemu_exe = find_qemu_exe()
qemu_dir = os.path.split(qemu_exe)[0]
parent_dir = os.getcwd()
os.chdir(qemu_dir)
cmd = quote(qemu_exe) + ' -L . -boot c' + ram + haxm \
cmd = quote(qemu_exe) + ' -L . -boot c' + optstr \
+ ' -hda //./PhysicalDrive' + str(disk_number)
try:
log("Executing ==> " + cmd)
subprocess.Popen(cmd, shell=True)
except:
QtWidgets.QMessageBox.information(self, 'Error...', 'Error booting USB\nUnable to start QEMU.')
QtWidgets.QMessageBox.information(
self, 'Error...',
'Error booting USB\nUnable to start QEMU.')
os.chdir(parent_dir)
elif platform.system() == "Linux":
cmd = qemu + ' -enable-kvm -hda "' + qemu_usb_disk + '"' + ram + ' -vga std'
cmd = qemu + ' -enable-kvm -hda "' + qemu_usb_disk + \
'"' + optstr + ' -vga std'
try:
log('Executing ==> ' + cmd)
subprocess.Popen(cmd, shell=True)

Loading…
Cancel
Save