Skip to content

Commit 770a57b

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 af8fa4e commit 770a57b

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
@@ -1689,6 +1689,22 @@ fn setup_composefs_boot(root_setup: &RootSetup, state: &State, image_id: &str) -
16891689
create_dir_all(state_path.join("etc/upper"))?;
16901690
create_dir_all(state_path.join("etc/work"))?;
16911691

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

0 commit comments

Comments
 (0)