From 4a68df45c768d5bb06385f0f2bf2e5b52cf54ab3 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 22 Aug 2022 12:57:16 +0200 Subject: [PATCH] osbuild: add ostree.deployment mount type New mount type added: org.osbuild.ostree.deployment. Adding this to a stage will setup all needed bind mounts so that a given `tree` will look like an active OSTree deployment, very much as OSTree does during early boot. This is often necessary when making changes to files in /etc for an ostree image. --- internal/osbuild/ostree_deployment_mount.go | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 internal/osbuild/ostree_deployment_mount.go diff --git a/internal/osbuild/ostree_deployment_mount.go b/internal/osbuild/ostree_deployment_mount.go new file mode 100644 index 000000000..e37abedd2 --- /dev/null +++ b/internal/osbuild/ostree_deployment_mount.go @@ -0,0 +1,32 @@ +package osbuild + +type OSTreeMountOptions struct { + Deployment OSTreeMountDeployment `json:"deployment"` +} + +func (OSTreeMountOptions) isMountOptions() {} + +type OSTreeMountDeployment struct { + // Name of the stateroot to be used in the deployment + OSName string `json:"osname"` + + // OStree ref to create and use for deployment + Ref string `json:"ref"` + + // The deployment serial (usually '0') + Serial *int `json:"serial,omitempty"` +} + +func NewOSTreeDeploymentMount(name, osName, ref string, serial int) *Mount { + return &Mount{ + Type: "org.osbuild.ostree.deployment", + Name: name, + Options: &OSTreeMountOptions{ + Deployment: OSTreeMountDeployment{ + OSName: osName, + Ref: ref, + Serial: &serial, + }, + }, + } +}