Skip to content

Commit

Permalink
bootloader: Pass source root
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Nov 13, 2024
1 parent 800a6d5 commit aab2c4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 9 additions & 1 deletion lib/src/bootloader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::{anyhow, bail, Context, Result};
use camino::{Utf8Path, Utf8PathBuf};
use cap_std_ext::cap_std::fs::Dir;
use fn_error_context::context;

use crate::blockdev::PartitionTable;
Expand Down Expand Up @@ -37,6 +38,7 @@ fn get_bootupd_device(device: &PartitionTable) -> Result<Utf8PathBuf> {
#[context("Installing bootloader")]
pub(crate) fn install_via_bootupd(
device: &PartitionTable,
src_root: &Dir,
rootfs: &Utf8Path,
configopts: &crate::install::InstallConfigOpts,
) -> Result<()> {
Expand All @@ -49,9 +51,15 @@ pub(crate) fn install_via_bootupd(
.into_iter()
.chain(verbose)
.chain(bootupd_opts.iter().copied().flatten())
.chain(["--device", devpath.as_str(), rootfs.as_str()]);
.chain([
"--src-root=.",
"--device",
devpath.as_str(),
rootfs.as_str(),
]);
Task::new("Running bootupctl to install bootloader", "bootupctl")
.args(args)
.cwd(src_root)?
.verbose()
.run()
}
Expand Down
7 changes: 4 additions & 3 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ async fn install_container(
state: &State,
root_setup: &RootSetup,
sysroot: &ostree::Sysroot,
) -> Result<(ostree::Deployment, InstallAleph)> {
) -> Result<(ostree::Deployment, Dir, InstallAleph)> {
let sepolicy = state.load_policy()?;
let sepolicy = sepolicy.as_ref();
let stateroot = state.stateroot();
Expand Down Expand Up @@ -837,7 +837,7 @@ async fn install_container(
selinux: state.selinux_state.to_aleph().to_string(),
};

Ok((deployment, aleph))
Ok((deployment, root, aleph))
}

/// Run a command in the host mount namespace
Expand Down Expand Up @@ -1314,7 +1314,7 @@ async fn install_with_sysroot(
) -> Result<()> {
// And actually set up the container in that root, returning a deployment and
// the aleph state (see below).
let (_deployment, aleph) = install_container(state, rootfs, &sysroot).await?;
let (deployment, deployment_root, aleph) = install_container(state, rootfs, &sysroot).await?;
// Write the aleph data that captures the system state at the time of provisioning for aid in future debugging.
rootfs
.rootfs_fd
Expand All @@ -1330,6 +1330,7 @@ async fn install_with_sysroot(
} else {
crate::bootloader::install_via_bootupd(
&rootfs.device_info,
&deployment_root,
&rootfs.rootfs,
&state.config_opts,
)?;
Expand Down

0 comments on commit aab2c4a

Please sign in to comment.