X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;fp=grml2usb;h=8e530d9246817e042fed08d2f6f9d8dc5616ace0;hp=bef2dc2b54fe3923d4c72843f5b59ee635a99e25;hb=de40a5f15798251f21bcd4b8795922e6ca188e42;hpb=3dd2d8e4798bf2ffcb0219aa6ec522765c4f02ad diff --git a/grml2usb b/grml2usb index bef2dc2..8e530d9 100755 --- a/grml2usb +++ b/grml2usb @@ -40,6 +40,7 @@ GRML_FLAVOURS = set() # which flavours are being installed? GRML_DEFAULT = None UUID = None SYSLINUX_LIBS = "/usr/lib/syslinux/" +GPT_HEADER = "\x55\xaa\x45\x46\x49\x20\x50\x41\x52\x54" # original GPT header RE_PARTITION = re.compile(r'([a-z/]*?)(\d+)$') RE_P_PARTITION = re.compile(r'(.*?\d+)p(\d+)$') @@ -318,9 +319,13 @@ def check_boot_flag(device): boot_dev, x = get_device_from_partition(device) with open(boot_dev, 'r') as image: - data = image.read(512) + data = image.read(520) bootcode = data[440:] - if bootcode[6] == '\x80': + gpt_data = bootcode[70:80] + + if gpt_data == GPT_HEADER: + logging.info("GPT detected, skipping bootflag check") + elif bootcode[6] == '\x80': logging.debug("bootflag is enabled") else: logging.debug("bootflag is NOT enabled")