write_composefs_state

Function write_composefs_state 

Source
pub(crate) async fn write_composefs_state(
    root_path: &Utf8PathBuf,
    deployment_id: &Sha512HashValue,
    target_imgref: &ImageReference,
    staged: Option<StagedDeployment>,
    boot_type: BootType,
    boot_digest: String,
    container_details: &ImgConfigManifest,
) -> Result<()>
Expand description

Creates and populates the composefs state directory for a deployment.

This function sets up the state directory structure and configuration files needed for a composefs deployment. It creates the deployment state directory, copies configuration, sets up the shared /var directory, and writes metadata files including the origin configuration and image information.

§Arguments

  • root_path - The root filesystem path (typically /sysroot)
  • deployment_id - Unique SHA512 hash identifier for this deployment
  • imgref - Container image reference for the deployment
  • staged - Whether this is a staged deployment (writes to transient state dir)
  • boot_type - Boot loader type (Bls or Uki)
  • boot_digest - Optional boot digest for verification
  • container_details - Container manifest and config used to create this deployment

§State Directory Structure

Creates the following structure under /sysroot/state/deploy/{deployment_id}/:

  • etc/ - Copy of system configuration files
  • var - Symlink to shared /var directory
  • {deployment_id}.origin - OSTree-style origin configuration
  • {deployment_id}.imginfo - Container image manifest and config as JSON

For staged deployments, also writes to /run/composefs/staged-deployment.