From 533b9e7cb13bf0b6e3da588e0399f9d2056a0086 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 23 Jan 2022 18:01:35 +0100 Subject: [PATCH] actually use the genfstab function --- src/functions/desktops.rs | 8 +++++++- src/functions/partition.rs | 11 ++--------- src/internal/files.rs | 6 +++++- src/internal/install.rs | 13 ++++++++----- src/internal/returncode_eval.rs | 2 +- src/main.rs | 2 ++ 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/functions/desktops.rs b/src/functions/desktops.rs index 573fa14..1aeb7d6 100755 --- a/src/functions/desktops.rs +++ b/src/functions/desktops.rs @@ -13,7 +13,13 @@ pub fn choose_pkgs(desktop_setup: &str) { ]); } "gnome" => { - install(vec!["xorg", "gnome", "gnome-tweaks", "chrome-gnome-shell", "gdm",]); + install(vec![ + "xorg", + "gnome", + "gnome-tweaks", + "chrome-gnome-shell", + "gdm", + ]); } "kde" => { install(vec![ diff --git a/src/functions/partition.rs b/src/functions/partition.rs index adbe1b1..39a1e88 100755 --- a/src/functions/partition.rs +++ b/src/functions/partition.rs @@ -309,16 +309,9 @@ fn mount(partition: &str, mountpoint: &str, options: &str) { exec_eval( exec( "mount", - vec![ - String::from(partition), - String::from(mountpoint), - ], + vec![String::from(partition), String::from(mountpoint)], ), - format!( - "mount {} with no options at {}", - partition, mountpoint - ) - .as_str(), + format!("mount {} with no options at {}", partition, mountpoint).as_str(), ); } } diff --git a/src/internal/files.rs b/src/internal/files.rs index 878ad0e..1584ae5 100755 --- a/src/internal/files.rs +++ b/src/internal/files.rs @@ -15,7 +15,11 @@ pub fn create_file(path: &str) { } pub fn append_file(path: &str, content: &str) -> std::io::Result<()> { - log(format!("[ \x1b[2;1;32mOK\x1b[0m ] Append '{}' to file {}", content.replace("\n", ""), path)); + log(format!( + "[ \x1b[2;1;32mOK\x1b[0m ] Append '{}' to file {}", + content.replace("\n", ""), + path + )); let mut file = OpenOptions::new().append(true).open(path)?; file.write_all(content.as_bytes())?; Ok(()) diff --git a/src/internal/install.rs b/src/internal/install.rs index 46aa91a..877995e 100755 --- a/src/internal/install.rs +++ b/src/internal/install.rs @@ -1,9 +1,12 @@ -use std::process::Command; use crate::internal::*; +use std::process::Command; pub fn install(pkgs: Vec<&str>) { - exec_eval(Command::new("crystalstrap") - .arg("/mnt") - .args(&pkgs) - .status(), format!("Install packages {}", pkgs.join(", ")).as_str()); + exec_eval( + Command::new("crystalstrap") + .arg("/mnt") + .args(&pkgs) + .status(), + format!("Install packages {}", pkgs.join(", ")).as_str(), + ); } diff --git a/src/internal/returncode_eval.rs b/src/internal/returncode_eval.rs index 01e8812..a60d9b6 100755 --- a/src/internal/returncode_eval.rs +++ b/src/internal/returncode_eval.rs @@ -2,7 +2,7 @@ use crate::internal::*; pub fn exec_eval( return_code: std::result::Result, - logmsg: &str + logmsg: &str, ) { match &return_code { Ok(_) => { diff --git a/src/main.rs b/src/main.rs index f358e3c..18dfd88 100755 --- a/src/main.rs +++ b/src/main.rs @@ -193,6 +193,8 @@ fn main() { } } else if app.subcommand_matches("install-base").is_some() { base::install_base_packages(); + } else if app.subcommand_matches("install-base").is_some() { + base::genfstab(); } else { println!("Running TUI installer"); }