- except HodorException as e:
- logging.info("%s, falling back to old bootflag detection", e)
- except ImportError:
- logging.debug("could not import parted, falling back to old bootflag detection")
-
- with open(boot_dev, "rb") as image:
- data = image.read(520)
- bootcode = data[440:]
- gpt_data = bootcode[70:80]
-
- if gpt_data == GPT_HEADER:
- logging.info("GPT detected, skipping bootflag check")
- elif bootcode[6] == b"\x80":
- logging.debug("bootflag is enabled")