mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-12 11:04:02 -06:00
add partition function
This commit is contained in:
parent
df7ab3e3ad
commit
329b99443d
1 changed files with 23 additions and 16 deletions
37
src/main.rs
37
src/main.rs
|
@ -34,9 +34,10 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
let root = Partition::builder()
|
let root = Partition::builder()
|
||||||
.partition_type(partition_type)
|
.partition_type(partition_type)
|
||||||
.name("Root")
|
.name("Root")
|
||||||
.size_in_sectors(121_634_816)
|
// Flash drive testing
|
||||||
// 500GB
|
// .size_in_sectors(121_634_816)
|
||||||
//.size_in_sectors(499_033_071_61)
|
// Internal drive testing
|
||||||
|
.size_in_sectors(499_033_071_61)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let _ = disk.partition_add(root)?;
|
let _ = disk.partition_add(root)?;
|
||||||
|
@ -46,6 +47,21 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn format_partitions() {
|
||||||
|
let _efi_partition = Command::new("mkfs.fat")
|
||||||
|
.arg("-F32")
|
||||||
|
.arg("-n")
|
||||||
|
.arg("EFI")
|
||||||
|
.arg("/dev/nvme1n1p1")
|
||||||
|
.output()
|
||||||
|
.expect("Failed to partition boot partition as FAT32");
|
||||||
|
|
||||||
|
let _root_partition = Command::new("mkfs.ext4")
|
||||||
|
.arg("/dev/nvme1n1p2")
|
||||||
|
.output()
|
||||||
|
.expect("Failed to partition root partition as ext4");
|
||||||
|
}
|
||||||
|
|
||||||
// fn mount_parts() {}
|
// fn mount_parts() {}
|
||||||
|
|
||||||
fn grab_flake() {
|
fn grab_flake() {
|
||||||
|
@ -120,6 +136,8 @@ fn main() {
|
||||||
println!("");
|
println!("");
|
||||||
println!("Use the full drive path such as /dev/nvme0n1 or /dev/sda");
|
println!("Use the full drive path such as /dev/nvme0n1 or /dev/sda");
|
||||||
println!("Which drive do we want to use for this installation?: {}", drive_name);
|
println!("Which drive do we want to use for this installation?: {}", drive_name);
|
||||||
|
println!("");
|
||||||
|
println!("If you're on the Lemur nvme1n1 is the test drive");
|
||||||
|
|
||||||
io::stdin()
|
io::stdin()
|
||||||
.read_line(&mut drive_name)
|
.read_line(&mut drive_name)
|
||||||
|
@ -131,18 +149,7 @@ fn main() {
|
||||||
let _ = format_drive(drive_name);
|
let _ = format_drive(drive_name);
|
||||||
|
|
||||||
// Formatting the partitions
|
// Formatting the partitions
|
||||||
let _efi_partition = Command::new("mkfs.fat")
|
format_partitions();
|
||||||
.arg("-F32")
|
|
||||||
.arg("-n")
|
|
||||||
.arg("EFI")
|
|
||||||
.arg("/dev/sda1")
|
|
||||||
.output()
|
|
||||||
.expect("Failed to partition boot partition as FAT32");
|
|
||||||
|
|
||||||
let _root_partition = Command::new("mkfs.ext4")
|
|
||||||
.arg("/dev/sda2")
|
|
||||||
.output()
|
|
||||||
.expect("Failed to partition root partition as ext4");
|
|
||||||
|
|
||||||
// Download nix files
|
// Download nix files
|
||||||
grab_flake();
|
grab_flake();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue