Skip to content

Commit afadfbd

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 2f3df69 commit afadfbd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/src/install.rs

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

1690+
let OstreeExtImgRef {
1691+
name: image_name,
1692+
transport,
1693+
} = &state.source.imageref;
1694+
1695+
let config = tini::Ini::new().section("origin").item(
1696+
ORIGIN_CONTAINER,
1697+
format!("ostree-unverified-image:{transport}{image_name}"),
1698+
);
1699+
1700+
let mut origin_file = std::fs::File::create(state_path.join(format!("{}.origin", id.to_hex())))
1701+
.context("Failed to open .origin file")?;
1702+
origin_file
1703+
.write(config.to_string().as_bytes())
1704+
.context("Falied to write to .origin file")?;
1705+
16901706
Ok(())
16911707
}
16921708

0 commit comments

Comments
 (0)