Skip to content

Commit 8ac9eae

Browse files
Johan-Liebert1jeckersbp5cgwalters
committed
Add a composefs backend
This adds a new off-by default feature to enable a new composefs-native backend for bootc. This is all still a live work in progress, but we're landing this first tranche of work to help avoid continual issues with rebasing. Thanks to everyone who worked on it! xref #1190 Co-authored-by: John Eckersberg <[email protected]> Co-authored-by: Robert Sturla <[email protected]> Co-authored-by: Colin Walters <[email protected]> Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent f4dfd81 commit 8ac9eae

File tree

30 files changed

+2699
-122
lines changed

30 files changed

+2699
-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.

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::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)