From 81cc143fd3292c9ffec4edefac869bfb44cab192 Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Wed, 19 Jun 2024 09:45:27 +0000 Subject: [PATCH] rpi_boot: use mount from CMDHelperFuncs --- src/otaclient/app/boot_control/_rpi_boot.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/otaclient/app/boot_control/_rpi_boot.py b/src/otaclient/app/boot_control/_rpi_boot.py index 7ab11ecb3..19b980b46 100644 --- a/src/otaclient/app/boot_control/_rpi_boot.py +++ b/src/otaclient/app/boot_control/_rpi_boot.py @@ -161,10 +161,12 @@ def __init__(self) -> None: _err_msg = f"system-boot is not mounted at {self.system_boot_mp}, try to mount it..." logger.warning(_err_msg) - mount_cmd = ["mount", "-o", "defaults"] try: - _mount_cmd = [*mount_cmd, system_boot_partition, self.system_boot_mp] - subprocess_run_wrapper(_mount_cmd, check=True, check_output=True) + CMDHelperFuncs.mount( + system_boot_partition, + self.system_boot_mp, + options=["defaults"], + ) except subprocess.CalledProcessError as e: _err_msg = ( f"failed to mount system-boot partition: {e!r}, {e.stderr.decode()}" @@ -295,11 +297,14 @@ def _prepare_flash_kernel(target_slot_mp: StrOrPath) -> Generator[None, Any, Non sys_mp = target_slot_mp / "sys" mounts[str(sys_mp)] = "/sys" - mount_cmd = ["mount", "-o", "bind", "--make-unbindable"] try: for _mp, _src in mounts.items(): - _mount_cmd = [*mount_cmd, _src, _mp] - subprocess_run_wrapper(_mount_cmd, check=True, check_output=True) + CMDHelperFuncs.mount( + _src, + _mp, + options=["bind"], + params=["--make-unbindable"], + ) yield # NOTE: passthrough the mount failure to caller finally: