Skip to content
Open
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
5 changes: 5 additions & 0 deletions src/bios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,9 @@ impl Component for Bios {
fn get_efi_vendor(&self, _: &Path) -> Result<Option<String>> {
Ok(None)
}

/// Package mode copy is EFI-only
fn package_mode_copy_to_boot(&self, _root: &Path) -> Result<()> {
Ok(())
}
}
16 changes: 16 additions & 0 deletions src/bootupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,22 @@ pub(crate) fn client_run_migrate_static_grub_config() -> Result<()> {
Ok(())
}

/// Copy bootloader files from /usr/lib/efi to boot/ESP for package mode installations.
pub(crate) fn copy_to_boot(root: &Path) -> Result<()> {
let all_components = get_components_impl(false);
if all_components.is_empty() {
anyhow::bail!("No components available for this platform.");
}

for component in all_components.values() {
component
.package_mode_copy_to_boot(root)
.with_context(|| format!("Failed to copy component {} to boot", component.name()))?;
}

Ok(())
}

/// Writes a stripped GRUB config to `stripped_config_name`, removing lines between
/// `### BEGIN /etc/grub.d/15_ostree ###` and `### END /etc/grub.d/15_ostree ###`.
fn strip_grub_config_file(
Expand Down
5 changes: 5 additions & 0 deletions src/cli/bootupctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub enum CtlBackend {
Generate(super::bootupd::GenerateOpts),
#[clap(name = "install", hide = true)]
Install(super::bootupd::InstallOpts),
#[clap(name = "copy-to-boot", hide = true)]
CopyToBoot,
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -109,6 +111,9 @@ impl CtlCommand {
CtlVerb::Backend(CtlBackend::Install(opts)) => {
super::bootupd::DCommand::run_install(opts)
}
CtlVerb::Backend(CtlBackend::CopyToBoot) => {
super::bootupd::DCommand::run_copy_to_boot()
}
CtlVerb::MigrateStaticGrubConfig => Self::run_migrate_static_grub_config(),
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/cli/bootupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ pub enum DVerb {
GenerateUpdateMetadata(GenerateOpts),
#[clap(name = "install", about = "Install components")]
Install(InstallOpts),
#[clap(
name = "copy-to-boot",
about = "Copy bootloader files from /usr/lib/efi to ESP (package mode), EFI only"
)]
CopyToBoot,
Comment thread
HuijingHei marked this conversation as resolved.
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -97,6 +102,7 @@ impl DCommand {
match self.cmd {
DVerb::Install(opts) => Self::run_install(opts),
DVerb::GenerateUpdateMetadata(opts) => Self::run_generate_meta(opts),
DVerb::CopyToBoot => Self::run_copy_to_boot(),
}
}

Expand Down Expand Up @@ -146,4 +152,9 @@ impl DCommand {
.context("boot data installation failed")?;
Ok(())
}

pub(crate) fn run_copy_to_boot() -> Result<()> {
bootupd::copy_to_boot(std::path::Path::new("/")).context("copying to boot failed")?;
Ok(())
}
}
3 changes: 3 additions & 0 deletions src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub(crate) trait Component {

/// Locating efi vendor dir
fn get_efi_vendor(&self, sysroot: &Path) -> Result<Option<String>>;

/// Merge `/usr/lib/efi` onto the ESP for package-mode systems (EFI components only).
fn package_mode_copy_to_boot(&self, root: &Path) -> Result<()>;
}

/// Given a component name, create an implementation.
Expand Down
Loading
Loading