Skip to content

Composefs-native backend #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a2768ef
cli/install: Add `composefs` option to `InstallToDiskOpts`
Johan-Liebert1 May 7, 2025
3c9f31d
install: Pull composefs repository
Johan-Liebert1 May 7, 2025
f3d9ab4
install/composefs: Write boot entries
Johan-Liebert1 May 13, 2025
c6c9aaa
Grub wip
Johan-Liebert1 May 16, 2025
5f4b13a
Use discoverable partition specification for rootfs UUID
Johan-Liebert1 May 20, 2025
7c62cfd
Bump composefs-rs
Johan-Liebert1 May 20, 2025
dbb29e1
install/composefs: Update composefs install options
Johan-Liebert1 Jun 11, 2025
1dd786b
install/composefs: Introduce flag for bls/uki boot
Johan-Liebert1 Jun 11, 2025
2313e3c
install/composefs: Get image and transport `source_imgref`
Johan-Liebert1 Jun 11, 2025
d15c988
install/composefs: Return result from opts.validate
Johan-Liebert1 Jun 17, 2025
f75689c
install/composefs: Handle kargs for BLS
Johan-Liebert1 Jun 17, 2025
6817ba7
install/composefs: Put UKI in the ESP
Johan-Liebert1 Jun 17, 2025
4e3bcec
cli/composefs: Implement `status` cmd for compoesfs booted system
Johan-Liebert1 Jun 20, 2025
6d2e5e7
install/composefs: Create origin file
Johan-Liebert1 Jun 24, 2025
92dba1c
install/composefs: Move state to `/state/deploy/<image_id>`
Johan-Liebert1 Jun 26, 2025
42d816c
cli: Implement `bootc status` for composefs native booted system
Johan-Liebert1 Jun 26, 2025
5f01e0d
install/composefs: Implement `bootc upgrade`
Johan-Liebert1 Jun 30, 2025
5887dbf
cli/composefs: Show staged/rollback deployments
Johan-Liebert1 Jul 1, 2025
71de32c
composefs/install: Write entries as staged
Johan-Liebert1 Jul 2, 2025
a0d96cd
cli/composefs: Implement `bootc switch`
Johan-Liebert1 Jul 2, 2025
0e6ce9d
install/composefs: Store boot type in origin file
Johan-Liebert1 Jul 14, 2025
d806a97
install/composefs: Remove dependency on composefs write_boot_simple
Johan-Liebert1 Jul 14, 2025
27d8e87
cli/install: Use lowercase DPS UUID
Johan-Liebert1 Jul 14, 2025
620df74
cli/composefs: Handle rollback for composefs
Johan-Liebert1 Jul 14, 2025
04f048f
Bump composefs-rs
Johan-Liebert1 Jul 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 100 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ tini = "1.3.0"
comfy-table = "7.1.1"
thiserror = { workspace = true }
canon-json = { workspace = true }
openat = "0.1.21"
openat-ext = "0.2.3"

[dev-dependencies]
similar-asserts = { workspace = true }
Expand Down
88 changes: 88 additions & 0 deletions crates/lib/src/bls_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
use serde::{Deserialize, Deserializer};
use serde::de::Error;
use std::collections::HashMap;
use anyhow::Result;

#[derive(Debug, Deserialize, Eq)]
pub(crate) struct BLSConfig {
pub(crate) title: Option<String>,
#[serde(deserialize_with = "deserialize_version")]
pub(crate) version: u32,
pub(crate) linux: String,
pub(crate) initrd: String,
pub(crate) options: String,

#[serde(flatten)]
pub(crate) extra: HashMap<String, String>,
}

impl PartialEq for BLSConfig {
fn eq(&self, other: &Self) -> bool {
self.version == other.version
}
}

impl PartialOrd for BLSConfig {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.version.partial_cmp(&other.version)
}
}

impl Ord for BLSConfig {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.version.cmp(&other.version)
}
}

impl BLSConfig {
pub(crate) fn to_string(&self) -> String {
let mut out = String::new();

if let Some(title) = &self.title {
out += &format!("title {}\n", title);
}

out += &format!("version {}\n", self.version);
out += &format!("linux {}\n", self.linux);
out += &format!("initrd {}\n", self.initrd);
out += &format!("options {}\n", self.options);

for (key, value) in &self.extra {
out += &format!("{} {}\n", key, value);
}

out
}
}

fn deserialize_version<'de, D>(deserializer: D) -> Result<u32, D::Error>
where
D: Deserializer<'de>,
{
let s: Option<String> = Option::deserialize(deserializer)?;

match s {
Some(s) => Ok(s.parse::<u32>().map_err(D::Error::custom)?),
None => Err(D::Error::custom("Version not found")),
}
}

pub(crate) fn parse_bls_config(input: &str) -> Result<BLSConfig> {
let mut map = HashMap::new();

for line in input.lines() {
let line = line.trim();
if line.is_empty() || line.starts_with('#') {
continue;
}

if let Some((key, value)) = line.split_once(' ') {
map.insert(key.to_string(), value.trim().to_string());
}
}

let value = serde_json::to_value(map)?;
let parsed: BLSConfig = serde_json::from_value(value)?;

Ok(parsed)
}
Loading
Loading