build and efi fixes

This commit is contained in:
Aiden McClelland
2025-11-14 19:00:33 -07:00
parent df636b7a78
commit 7210f43f50
10 changed files with 48 additions and 8 deletions

View File

@@ -280,6 +280,9 @@ pub async fn list(os: &OsPartitionInfo) -> Result<Vec<DiskInfo>, Error> {
.try_fold(
BTreeMap::<PathBuf, DiskIndex>::new(),
|mut disks, dir_entry| async move {
if dir_entry.file_type().await?.is_dir() {
return Ok(disks);
}
if let Some(disk_path) = dir_entry.path().file_name().and_then(|s| s.to_str()) {
let (disk_path, part_path) = if let Some(end) = PARTITION_REGEX.find(disk_path) {
(

View File

@@ -356,7 +356,10 @@ pub async fn execute<C: Context>(
let mut install = Command::new("chroot");
install.arg(overlay.path()).arg("grub-install");
if tokio::fs::metadata("/sys/firmware/efi").await.is_err() {
install.arg("--target=i386-pc");
match ARCH {
"x86_64" => install.arg("--target=i386-pc"),
_ => &mut install,
};
} else {
match ARCH {
"x86_64" => install.arg("--target=x86_64-efi"),

View File

@@ -1,4 +1,5 @@
use std::collections::BTreeMap;
use std::env::consts::ARCH;
use std::path::Path;
use std::time::Duration;
@@ -498,6 +499,12 @@ async fn do_update(
None
};
Command::new("chroot")
.arg(root_guard.path())
.arg("grub-install")
.invoke(crate::ErrorKind::Grub)
.await?;
Command::new("chroot")
.arg(root_guard.path())
.arg("update-grub2")