Skip to content

Commit

Permalink
rpi_boot: add back the sanity check, ensure we are running on raspber…
Browse files Browse the repository at this point in the history
…ry pi device
  • Loading branch information
Bodong-Yang committed Jun 19, 2024
1 parent 8560a08 commit 41e80fc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/otaclient/app/boot_control/_rpi_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ def __init__(self) -> None:
self.system_boot_mp = Path(cfg.SYSTEM_BOOT_MOUNT_POINT)
self.system_boot_mp.mkdir(exist_ok=True)

# sanity check, ensure we are running at raspberry pi device
model_fpath = Path(cfg.RPI_MODEL_FILE)
err_not_rpi_device = f"{cfg.RPI_MODEL_FILE} doesn't exist! Are we running at raspberry pi device?"
if not model_fpath.is_file():
logger.error(err_not_rpi_device)
raise _RPIBootControllerError(err_not_rpi_device)

model_info = model_fpath.read_text()
if model_info.find("Pi") == -1:
raise _RPIBootControllerError(err_not_rpi_device)
logger.info(f"{model_info=}")

try:
# ------ detect active slot ------ #
active_slot_dev = CMDHelperFuncs.get_current_rootfs_dev()
Expand Down

0 comments on commit 41e80fc

Please sign in to comment.