Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions crates/lib/src/kargs.rs → crates/lib/src/bootc_kargs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! This module handles the bootc-owned kernel argument lists in `/usr/lib/bootc/kargs.d`.
use anyhow::{Context, Result};
use camino::Utf8Path;
use cap_std_ext::cap_std::fs::Dir;
Expand All @@ -15,6 +16,7 @@ use serde::Deserialize;
use crate::deploy::ImageState;
use crate::store::Storage;

/// The relative path to the kernel arguments which may be embedded in an image.
const KARGS_PATH: &str = "usr/lib/bootc/kargs.d";

/// The kargs.d configuration file.
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ async fn deploy(
// is a distinct minor issue, but not super important as right now the install path
// doesn't use this API).
let override_kargs = if let Some(deployment) = merge_deployment {
Some(crate::kargs::get_kargs(sysroot, &deployment, image)?)
Some(crate::bootc_kargs::get_kargs(sysroot, &deployment, image)?)
} else {
None
};
Expand Down
13 changes: 7 additions & 6 deletions crates/lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use self::baseline::InstallBlockDeviceOpts;
use crate::boundimage::{BoundImage, ResolvedBoundImage};
use crate::containerenv::ContainerExecutionInfo;
use crate::deploy::{prepare_for_pull, pull_from_prepared, PreparedImportMeta, PreparedPullResult};
use crate::kernel::Cmdline;
use crate::kernel_cmdline::Cmdline;
use crate::lsm;
use crate::progress_jsonl::ProgressWriter;
use crate::spec::ImageReference;
Expand Down Expand Up @@ -817,7 +817,7 @@ async fn install_container(
.repo()
.read_commit(pulled_image.ostree_commit.as_str(), gio::Cancellable::NONE)?
.0;
let kargsd = crate::kargs::get_kargs_from_ostree_root(
let kargsd = crate::bootc_kargs::get_kargs_from_ostree_root(
&sysroot.repo(),
merged_ostree_root.downcast_ref().unwrap(),
std::env::consts::ARCH,
Expand Down Expand Up @@ -1668,10 +1668,11 @@ fn find_root_args_to_inherit(cmdline: &Cmdline, root_info: &Filesystem) -> Resul
.context("Parsing root= karg")?;
// If we have a root= karg, then use that
let (mount_spec, kargs) = if let Some(root) = root {
let rootflags = cmdline.find(crate::kernel::ROOTFLAGS);
let inherit_kargs = cmdline
.iter()
.filter(|arg| arg.key.starts_with(crate::kernel::INITRD_ARG_PREFIX));
let rootflags = cmdline.find(crate::kernel_cmdline::ROOTFLAGS);
let inherit_kargs = cmdline.iter().filter(|arg| {
arg.key
.starts_with(crate::kernel_cmdline::INITRD_ARG_PREFIX)
});
(
root.to_owned(),
rootflags
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/install/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn reconcile_kargs(sysroot: &ostree::Sysroot, deployment: &ostree::Deployment) -
.flatten()
.map(|s| s.as_str())
.collect::<Vec<_>>();
let kargsd = crate::kargs::get_kargs_in_root(deployment_root, std::env::consts::ARCH)?;
let kargsd = crate::bootc_kargs::get_kargs_in_root(deployment_root, std::env::consts::ARCH)?;
let kargsd = kargsd.iter().map(|s| s.as_str()).collect::<Vec<_>>();

current_kargs.append_argv(&install_config_kargs);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! to provide a fully "container native" tool for using
//! bootable container images.

pub(crate) mod bootc_kargs;
mod boundimage;
mod cfsctl;
pub mod cli;
Expand All @@ -15,7 +16,6 @@ mod image;
mod imgstorage;
pub(crate) mod journal;
mod k8sapitypes;
pub(crate) mod kargs;
mod lints;
mod lsm;
pub(crate) mod metadata;
Expand All @@ -34,7 +34,7 @@ mod docgen;
mod bootloader;
mod containerenv;
mod install;
mod kernel;
mod kernel_cmdline;

#[cfg(feature = "grub")]
pub(crate) mod parsers;
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static LINT_KARGS: Lint = Lint::new_fatal(
check_parse_kargs,
);
fn check_parse_kargs(root: &Dir, _config: &LintExecutionConfig) -> LintResult {
let args = crate::kargs::get_kargs_in_root(root, ARCH)?;
let args = crate::bootc_kargs::get_kargs_in_root(root, ARCH)?;
tracing::debug!("found kargs: {args:?}");
lint_ok()
}
Expand Down