fix grub efi boot path issue

axtloss/rework-partitioning
axtlos 3 years ago
parent 3220b9ea5d
commit 4766458bca
No known key found for this signature in database
GPG Key ID: A468AFD71DD51D4A

@ -39,16 +39,17 @@ pub fn genfstab() {
pub fn install_bootloader_efi(efidir: PathBuf) {
install::install(vec!["grub", "efibootmgr", "grub-btrfs"]);
if !efidir.exists() {
let efidir = std::path::Path::new("/mnt").join(efidir);
let efi_str = efidir.to_str().unwrap();
if !std::path::Path::new(&format!("/mnt{efi_str}")).exists() {
crash(format!("The efidir {efidir:?} doesn't exist"), 1);
}
let efidir = efidir.to_string_lossy().to_string();
exec_eval(
exec_chroot(
"grub-install",
vec![
String::from("--target=x86_64-efi"),
format!("--efi-directory={}", efidir),
format!("--efi-directory={}" , efi_str),
String::from("--bootloader-id=crystal"),
String::from("--removable"),
],
@ -60,7 +61,7 @@ pub fn install_bootloader_efi(efidir: PathBuf) {
"grub-install",
vec![
String::from("--target=x86_64-efi"),
format!("--efi-directory={}", efidir),
format!("--efi-directory={}", efi_str),
String::from("--bootloader-id=crystal"),
],
),

@ -158,7 +158,7 @@ pub fn fmt_mount(mountpoint: &String, filesystem: &String, blockdevice: &String)
mount(&blockdevice, &mountpoint, "");
}
pub fn partition(device: PathBuf, mode: PartitionMode, efi: bool, partitions: Vec<args::Partition>) {
pub fn partition(device: PathBuf, mode: PartitionMode, efi: bool, partitions: &mut Vec<args::Partition>) {
println!("{:?}", mode);
match mode {
@ -180,6 +180,7 @@ pub fn partition(device: PathBuf, mode: PartitionMode, efi: bool, partitions: Ve
}
PartitionMode::Manual => {
log::debug!("Manual partitioning");
partitions.sort_by(|a, b| a.mountpoint.len().cmp(&b.mountpoint.len()));
for i in 0..partitions.len() {
println!("{:?}", partitions);
println!("{}", partitions.len());

@ -91,7 +91,7 @@ pub fn read_config(configpath: PathBuf) {
PathBuf::from("/dev/").join(config.partition.device),
config.partition.mode,
config.partition.efi,
partitions,
&mut partitions,
);
base::install_base_packages();
base::genfstab();

@ -13,7 +13,8 @@ fn main() {
logging::init(opt.verbose);
match opt.command {
Command::Partition(args) => {
partition::partition(args.device, args.mode, args.efi, args.partitions);
let mut partitions = args.partitions;
partition::partition(args.device, args.mode, args.efi, &mut partitions);
}
Command::InstallBase => {
base::install_base_packages();

Loading…
Cancel
Save