Skip to content

Commit 19e82be

Browse files
authored
Merge pull request #1444 from bootc-dev/composefs-backend
Add a composefs backend
2 parents 86f1157 + 6a73da7 commit 19e82be

File tree

31 files changed

+2805
-122
lines changed

31 files changed

+2805
-122
lines changed

Cargo.lock

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

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ validate-rust:
113113
cargo test --no-run
114114
(cd crates/ostree-ext && cargo check --no-default-features)
115115
(cd crates/lib && cargo check --no-default-features)
116+
cargo check --features=composefs-backend
116117
cargo clippy -- $(CLIPPY_CONFIG)
117118
env RUSTDOCFLAGS='-D warnings' cargo doc --lib
118119
.PHONY: validate-rust

crates/etc-merge/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ use cap_std_ext::dirext::CapStdExtDirExt;
2020
use composefs::fsverity::{FsVerityHashValue, Sha256HashValue, Sha512HashValue};
2121
use composefs::generic_tree::{Directory, Inode, Leaf, LeafContent, Stat};
2222
use composefs::tree::ImageError;
23-
use rustix::fs::{AtFlags, Gid, Uid, XattrFlags, lgetxattr, llistxattr, lsetxattr, readlinkat};
23+
use rustix::fs::{
24+
AtFlags, Gid, Uid, XattrFlags, lgetxattr, llistxattr, lsetxattr, readlinkat, symlinkat,
25+
};
2426

2527
/// Metadata associated with a file, directory, or symlink entry.
2628
#[derive(Debug)]
@@ -627,9 +629,8 @@ fn merge_leaf(
627629
.context(format!("Deleting {file:?}"))?;
628630

629631
if let Some(target) = symlink {
630-
new_etc_fd
631-
.symlink(target.as_ref(), &file)
632-
.context(format!("Creating symlink {file:?}"))?;
632+
// Using rustix's symlinkat here as we might have absolute symlinks which clash with ambient_authority
633+
symlinkat(&**target, new_etc_fd, file).context(format!("Creating symlink {file:?}"))?;
633634
} else {
634635
current_etc_fd
635636
.copy(&file, new_etc_fd, &file)

crates/initramfs/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ pub fn mount_at_wrapper(
112112
.with_context(|| format!("Mounting at path {path:?}"))
113113
}
114114

115+
/// Wrapper around [`rustix::fs::openat`]
115116
#[context("Opening dir {name:?}")]
116-
fn open_dir(dirfd: impl AsFd, name: impl AsRef<Path> + Debug) -> Result<OwnedFd> {
117+
pub fn open_dir(dirfd: impl AsFd, name: impl AsRef<Path> + Debug) -> Result<OwnedFd> {
117118
let res = openat(
118119
dirfd,
119120
name.as_ref(),

crates/kernel_cmdline/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
1313
pub mod bytes;
1414
pub mod utf8;
15+
16+
/// This is used by dracut.
17+
pub const INITRD_ARG_PREFIX: &str = "rd.";
18+
/// The kernel argument for configuring the rootfs flags.
19+
pub const ROOTFLAGS: &str = "rootflags";

crates/lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bootc-tmpfiles = { path = "../tmpfiles" }
2323
bootc-utils = { package = "bootc-internal-utils", path = "../utils", version = "0.0.0" }
2424
ostree-ext = { path = "../ostree-ext", features = ["bootc"] }
2525
etc-merge = { path = "../etc-merge" }
26+
bootc-initramfs-setup = { path = "../initramfs" }
2627

2728
# Workspace dependencies
2829
anstream = { workspace = true }

0 commit comments

Comments
 (0)