Skip to content

Commit

Permalink
rpi_boot: use mount from CMDHelperFuncs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Jun 19, 2024
1 parent b149289 commit 81cc143
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/otaclient/app/boot_control/_rpi_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 81cc143

Please sign in to comment.