From: Michael Prokop Date: Wed, 15 May 2013 11:59:00 +0000 (+0200) Subject: Skip check for bootflag if a GPT header is present X-Git-Tag: v0.13.8~1 X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=de40a5f15798251f21bcd4b8795922e6ca188e42 Skip check for bootflag if a GPT header is present The bootflag is not required when using GPT, so skip the check and do not fail if no bootflag is present. --- 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")