From 0d50ec605d86bd0c3f2f1f2c51ba6a945a5ae3e3 Mon Sep 17 00:00:00 2001 From: axtlos Date: Thu, 12 May 2022 18:46:24 +0200 Subject: [PATCH] it works :D --- src/functions/partition.rs | 1 + src/functions/unakite.rs | 44 +++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/functions/partition.rs b/src/functions/partition.rs index 4471ce3..7b6697c 100755 --- a/src/functions/partition.rs +++ b/src/functions/partition.rs @@ -93,6 +93,7 @@ pub fn fmt_mount(mountpoint: &str, filesystem: &str, blockdevice: &str) { exec( "mkfs.btrfs", vec![ + String::from("-f"), String::from(blockdevice), ], ), diff --git a/src/functions/unakite.rs b/src/functions/unakite.rs index 31189f7..dc71a10 100644 --- a/src/functions/unakite.rs +++ b/src/functions/unakite.rs @@ -59,11 +59,21 @@ pub fn remount(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str exec_eval( exec( "umount", - vec![String::from("/")], + vec![String::from(oldroot)], ), "Unmount old root", ); - mount(root, "/", ""); + mount(root, "/mnt", ""); + exec_eval( + exec( + "mkdir", + vec![ + String::from("-p"), + String::from(efidir), + ], + ), + format!("Creating mountpoint {efidir} for {bootdev}").as_str(), + ); mount(bootdev, efidir, ""); } else if efi && !firstrun { exec_eval( @@ -76,11 +86,11 @@ pub fn remount(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str exec_eval( exec( "umount", - vec![String::from("/")], + vec![String::from(root)], ), "Unmount unakite root", ); - mount(root, "/", ""); + mount(oldroot, "/mnt", ""); mount(bootdev, efidir, ""); } else if !efi && firstrun { exec_eval( @@ -93,12 +103,22 @@ pub fn remount(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str exec_eval( exec( "umount", - vec![String::from("/")], + vec![String::from(oldroot)], ), "Unmount old root", ); - mount(root, "/", ""); - mount(bootdev, "/boot", ""); + mount(root, "/mnt", ""); + exec_eval( + exec( + "mkdir", + vec![ + String::from("-p"), + String::from("/mnt/boot"), + ], + ), + format!("Creating mountpoint /boot for {bootdev}").as_str(), + ); + mount(bootdev, "/mnt/boot", ""); } else if !efi && !firstrun { exec_eval( exec( @@ -110,12 +130,12 @@ pub fn remount(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str exec_eval( exec( "umount", - vec![String::from("/")], + vec![String::from(root)], ), "Unmount unakite root", ); - mount(oldroot, "/", ""); - mount(bootdev, "/boot", ""); + mount(oldroot, "/mnt", ""); + mount(bootdev, "/mnt/boot", ""); } else { panic!("Unknown state"); } @@ -127,9 +147,9 @@ pub fn setup_unakite(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev base::install_base_packages(); base::genfstab(); if efi { - install_bootloader_efi(PathBuf::from(efidir)); + install_bootloader_efi(PathBuf::from(efidir.replace("/mnt", ""))); } - locale::set_locale("".to_string()); + locale::set_locale("en_US.UTF-8 UTF-8".to_string()); locale::set_timezone("Europe/Berlin"); // TODO: get the proper timezone network::set_hostname("unakite"); network::create_hosts();