Skip to content

Commit f365b70

Browse files
cgwaltersgursewak1997
authored andcommitted
Add systemd structured logging for bootc state changes
Log key operations (deploy, upgrade, switch, install, etc.) to systemd journal with structured fields including image references, digests, and operation types. Uses existing journal infrastructure and follows ostree logging pattern.
2 parents 694e0ab + 0ef1eca commit f365b70

File tree

14 files changed

+623
-59
lines changed

14 files changed

+623
-59
lines changed

Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ tokio-util = { features = ["io-util"], version = "0.7.10" }
6565
toml = "0.9.5"
6666
tracing = "0.1.40"
6767
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
68+
tracing-journald = "0.3.1"
6869
uzers = "0.12"
6970
xshell = "0.2.6"
7071

crates/initramfs/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ publish = false
77

88
[dependencies]
99
anyhow.workspace = true
10+
clap = { workspace = true, features = ["std", "help", "usage", "derive"] }
11+
rustix.workspace = true
12+
serde = { workspace = true, features = ["derive"] }
13+
composefs.workspace = true
14+
composefs-boot.workspace = true
15+
toml.workspace = true
1016

1117
[lints]
1218
workspace = true
19+
20+
[features]
21+
default = ['pre-6.15']
22+
rhel9 = ['composefs/rhel9']
23+
'pre-6.15' = ['composefs/pre-6.15']

crates/initramfs/bootc-root-setup.service

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
Description=bootc setup root
33
Documentation=man:bootc(1)
44
DefaultDependencies=no
5-
# For now
6-
ConditionKernelCommandLine=ostree
5+
ConditionKernelCommandLine=composefs
76
ConditionPathExists=/etc/initrd-release
87
After=sysroot.mount
98
After=ostree-prepare-root.service

crates/initramfs/src/main.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
//! Code for bootc that goes into the initramfs.
2-
//! At the current time, this is mostly just a no-op.
32
// SPDX-License-Identifier: Apache-2.0 OR MIT
43

4+
mod mount;
5+
56
use anyhow::Result;
67

7-
fn setup_root() -> Result<()> {
8-
let _ = std::fs::metadata("/sysroot/usr")?;
9-
println!("setup OK");
10-
Ok(())
11-
}
8+
use clap::Parser;
9+
use mount::{gpt_workaround, setup_root, Args};
1210

1311
fn main() -> Result<()> {
14-
let v = std::env::args().collect::<Vec<_>>();
15-
let args = match v.as_slice() {
16-
[] => anyhow::bail!("Missing argument".to_string()),
17-
[_, rest @ ..] => rest,
18-
};
19-
match args {
20-
[] => anyhow::bail!("Missing argument".to_string()),
21-
[s] if s == "setup-root" => setup_root(),
22-
[o, ..] => anyhow::bail!(format!("Unknown command {o}")),
23-
}
12+
let args = Args::parse();
13+
gpt_workaround()?;
14+
setup_root(args)
2415
}

0 commit comments

Comments
 (0)