Skip to content

Commit 6d2e5e7

Browse files
install/composefs: Create origin file
Create a .origin file in /sysroot/state to store image info Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 4e3bcec commit 6d2e5e7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/lib/src/install.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,22 @@ fn setup_composefs_boot(root_setup: &RootSetup, state: &State, image_id: &str) -
16801680
create_dir_all(state_path.join("etc/upper"))?;
16811681
create_dir_all(state_path.join("etc/work"))?;
16821682

1683+
let OstreeExtImgRef {
1684+
name: image_name,
1685+
transport,
1686+
} = &state.source.imageref;
1687+
1688+
let config = tini::Ini::new().section("origin").item(
1689+
ORIGIN_CONTAINER,
1690+
format!("ostree-unverified-image:{transport}{image_name}"),
1691+
);
1692+
1693+
let mut origin_file = std::fs::File::create(state_path.join(format!("{}.origin", id.to_hex())))
1694+
.context("Failed to open .origin file")?;
1695+
origin_file
1696+
.write(config.to_string().as_bytes())
1697+
.context("Falied to write to .origin file")?;
1698+
16831699
Ok(())
16841700
}
16851701

0 commit comments

Comments
 (0)