Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fwutil]: Fix next image mount #1533

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion fwutil/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ class SquashFs(object):
OVERLAY_MOUNTPOINT_TEMPLATE = "/tmp/image-{}-overlay"

def __init__(self):
image_stem = self.next_image.lstrip(self.OS_PREFIX)
image_stem = self.next_image

if image_stem.startswith(self.OS_PREFIX):
image_stem = image_stem[len(self.OS_PREFIX):]

self.fs_path = self.FS_PATH_TEMPLATE.format(image_stem)
self.fs_rw = self.FS_RW_TEMPLATE.format(image_stem)
Expand Down Expand Up @@ -245,6 +248,9 @@ def mount_next_image_fs(self):
)
subprocess.check_call(cmd, shell=True)

if not (os.path.exists(self.fs_rw) and os.path.exists(self.fs_work)):
return self.fs_mountpoint

os.mkdir(self.overlay_mountpoint)
cmd = "mount -n -r -t overlay -o lowerdir={},upperdir={},workdir={} overlay {}".format(
self.fs_mountpoint,
Expand Down