From 8f8d8eb433251ef9dcf6d9efd30ae2b6cbc9fb0f Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Wed, 19 Jun 2024 02:38:41 +0000 Subject: [PATCH] rpi_boot: hide the flag_file things to _RPIBootControl --- src/otaclient/app/boot_control/_rpi_boot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/otaclient/app/boot_control/_rpi_boot.py b/src/otaclient/app/boot_control/_rpi_boot.py index 9ce153f1a..6820d8f24 100644 --- a/src/otaclient/app/boot_control/_rpi_boot.py +++ b/src/otaclient/app/boot_control/_rpi_boot.py @@ -178,6 +178,10 @@ def __init__(self) -> None: self._check_boot_files() self._check_active_slot_id() + # NOTE(20240604): for backward compatibility, always remove flag file + flag_file = Path(cfg.SYSTEM_BOOT_MOUNT_POINT) / cfg.SWITCH_BOOT_FLAG_FILE + flag_file.unlink(missing_ok=True) + def _check_active_slot_id(self): """Check whether the active slot fslabel is matching the slot id. @@ -414,10 +418,6 @@ def __init__(self) -> None: / Path(cfg.OTA_STATUS_DIR).relative_to("/"), finalize_switching_boot=self._rpiboot_control.finalize_switching_boot, ) - - # NOTE(20240604): for backward compatibility, always remove flag file - flag_file = Path(cfg.SYSTEM_BOOT_MOUNT_POINT) / cfg.SWITCH_BOOT_FLAG_FILE - flag_file.unlink(missing_ok=True) logger.info("rpi_boot starting finished") except Exception as e: _err_msg = f"failed to start rpi boot controller: {e!r}"