mounts/ostree.deployment: use target instead of tree
We still target the tree here, but we open ourselves up to be able to target something other than the tree in the future. This mostly exchanges the `tree` variable for `target`. We also update the comment to try to enhance clarity.
This commit is contained in:
parent
e43abe1a9c
commit
be90d8c36c
1 changed files with 17 additions and 12 deletions
|
|
@ -98,32 +98,37 @@ class OSTreeDeploymentMount(mounts.MountService):
|
|||
ref = deployment["ref"]
|
||||
serial = deployment.get("serial", 0)
|
||||
|
||||
# create a private mountpoint for the tree, which is needed
|
||||
# in order to be able to move the `root` mountpoint, which
|
||||
# is contained inside tree, since "moving a mount residing
|
||||
# under a shared mount is invalid and unsupported."
|
||||
# The target path where we want the deployment to be mounted
|
||||
# is the root of the tree.
|
||||
target = tree
|
||||
|
||||
# create a private mountpoint for the target path, which is
|
||||
# needed in order to be able to move the deployment `root`
|
||||
# mountpoint here, which is contained inside tree, since
|
||||
# "moving a mount residing under a shared mount is invalid
|
||||
# and unsupported."
|
||||
# - `mount(8)`
|
||||
self.bind_mount(tree, tree)
|
||||
self.bind_mount(target, target)
|
||||
|
||||
deploy_root = ostree.deployment_path(tree, osname, ref, serial)
|
||||
deploy_root = ostree.deployment_path(target, osname, ref, serial)
|
||||
|
||||
print(f"Deployment root at '{os.path.relpath(deploy_root, tree)}'")
|
||||
print(f"Deployment root at '{os.path.relpath(deploy_root, target)}'")
|
||||
|
||||
var = os.path.join(tree, "ostree", "deploy", osname, "var")
|
||||
boot = os.path.join(tree, "boot")
|
||||
var = os.path.join(target, "ostree", "deploy", osname, "var")
|
||||
boot = os.path.join(target, "boot")
|
||||
|
||||
self.mountpoint = deploy_root
|
||||
self.bind_mount(deploy_root, deploy_root) # prepare to move it later
|
||||
|
||||
self.bind_mount(tree, os.path.join(deploy_root, "sysroot"))
|
||||
self.bind_mount(target, os.path.join(deploy_root, "sysroot"))
|
||||
self.bind_mount(var, os.path.join(deploy_root, "var"))
|
||||
self.bind_mount(boot, os.path.join(deploy_root, "boot"))
|
||||
|
||||
subprocess.run([
|
||||
"mount", "--move", deploy_root, tree,
|
||||
"mount", "--move", deploy_root, target,
|
||||
], check=True)
|
||||
|
||||
self.mountpoint = tree
|
||||
self.mountpoint = target
|
||||
self.check = True
|
||||
|
||||
def umount(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue