2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-18 15:25:46 +00:00

Fix import error under Linux correct the gpt detection code under Linux

This commit is contained in:
Sundar 2017-11-12 23:22:58 +05:30
parent 2394e15ff8
commit 2c91ed4c7f
2 changed files with 9 additions and 2 deletions

View File

@ -27,7 +27,6 @@ def gpt_part_table(usb_disk):
Check if selected USB contain GPT or MBR partition table
:return: True if GPT else False
"""
win_usb_disk_no = str(usb.get_physical_disk_number(config.usb_disk))
if platform.system() == "Linux":
_cmd_out = subprocess.check_output("parted " + usb_disk[:-1] + " print", shell=True)
if b'msdos' in _cmd_out:
@ -35,6 +34,7 @@ def gpt_part_table(usb_disk):
elif b'gpt' in _cmd_out:
return True
elif platform.system() == 'Windows':
win_usb_disk_no = str(usb.get_physical_disk_number(config.usb_disk))
if config.usb_gpt is True:
return True
elif config.usb_gpt is False:

View File

@ -377,10 +377,17 @@ def gpt_device(dev_name):
gen.log('Device ' + dev_name + ' is a GPT disk...')
return False
if platform.system() == "Linux":
_cmd_out = subprocess.check_output("parted " + dev_name[:-1] + " print", shell=True)
if gen.has_digit(dev_name):
_cmd_out = subprocess.check_output("parted " + dev_name[:-1] + " print", shell=True)
else:
_cmd_out = subprocess.check_output("parted " + dev_name + " print", shell=True)
if b'msdos' in _cmd_out:
config.usb_gpt = False
gen.log('Device ' + dev_name + ' is a MBR disk...')
return False
elif b'gpt' in _cmd_out:
config.usb_gpt = True
gen.log('Device ' + dev_name + ' is a GPT disk...')
return True