Fix for crash on windows:

1. This is yet another fix for crash under windows due to detecttion in partition type
2. Fix for syslinux install when USB disk is not inserted.
3. Now syslinux install properly copy required files after install
4. Intimate users if USB disk not inserted when trying to install syslinux
5. Update version to 9.2.0
pull/276/head
mbusb 6 years ago
parent c203f28e6a
commit 3136ffe4fa

@ -1 +1 @@
9.1.0
9.2.0

@ -350,7 +350,11 @@ Are you SURE you want to enable it?",
"""
self.ui_disable_controls()
if platform.system() == "Linux" or platform.system() == "Windows":
if not config.usb_disk:
log("ERROR Syslinux Install : No USB device found.")
QtWidgets.QMessageBox.information(self, "No Device...",
"No USB device found.\n\nInsert USB and use Refresh USB button to detect USB.")
elif platform.system() == "Linux" or platform.system() == "Windows":
if self.ui.check_install_sys_all.isChecked() or self.ui.check_install_sys_only.isChecked():
if platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is False:
gen.log('Selected USB is a disk. Please select a disk partition from the drop down list')

@ -182,6 +182,7 @@ def syslinux_default(usb_disk):
else:
log('Disk uses GPT and mbr install is not required...')
'''
return True
else:
log("\nFailed to install default syslinux...\n")

@ -361,25 +361,35 @@ def gpt_device(dev_name):
:return: True if GPT else False
"""
if platform.system() == 'Windows':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
diskpart_cmd = 'wmic partition get name, type'
# We have to check using byte code else it crashes when system language is other than English
dev_no = get_physical_disk_number(dev_name).encode()
cmd_out = subprocess.check_output(diskpart_cmd, subprocess.SW_HIDE, startupinfo=startupinfo)
gen.log(cmd_out)
cmd_spt = cmd_out.split(b'\r')
for line in cmd_spt:
# line = line('utf-8')
if b'#' + dev_no + b',' in line:
if b'GPT' not in line:
config.usb_gpt = False
gen.log('Device ' + dev_name + ' is a MBR disk...')
return False
else:
config.usb_gpt = True
gen.log('Device ' + dev_name + ' is a GPT disk...')
return True
try:
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = os.open(os.devnull, os.O_RDWR)
# DEVNULL = os.open(os.devnull, os.O_RDWR)
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
diskpart_cmd = 'wmic partition get name, type'
# We have to check using byte code else it crashes when system language is other than English
dev_no = get_physical_disk_number(dev_name).encode()
# Below line fails on onefile windows binary
# cmd_out = subprocess.check_output(diskpart_cmd, subprocess.SW_HIDE, startupinfo=startupinfo, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
cmd_out = subprocess.check_output(diskpart_cmd, subprocess.SW_HIDE, startupinfo=startupinfo, stdin=DEVNULL, stderr=DEVNULL)
gen.log(cmd_out)
cmd_spt = cmd_out.split(b'\r')
for line in cmd_spt:
# line = line('utf-8')
if b'#' + dev_no + b',' in line:
if b'GPT' not in line:
config.usb_gpt = False
gen.log('Device ' + dev_name + ' is a MBR disk...')
return False
else:
config.usb_gpt = True
gen.log('Device ' + dev_name + ' is a GPT disk...')
return True
except Exception as e:
gen.log(e)
if platform.system() == "Linux":
if gen.has_digit(dev_name):

Loading…
Cancel
Save