diff --git a/README.md b/README.md index 37cf236..7e4886f 100755 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ jade genfstab ### configuring locale settings ```sh # set the keyboard layout to colemak, the timezone to Europe/Berlin and set en_US.UTF-8 as the locale -jade locale colemak Europe/Berlin "en_US.UTF-8 UTF-8" +jade locale colemak Europe/Berlin en_US.UTF-8 UTF-8 ``` ### configue network settings diff --git a/crystal@192.168.122.60 b/crystal@192.168.122.60 deleted file mode 100755 index 6c768a8..0000000 Binary files a/crystal@192.168.122.60 and /dev/null differ diff --git a/src/internal/config.rs b/src/internal/config.rs index c2e3506..b29c438 100755 --- a/src/internal/config.rs +++ b/src/internal/config.rs @@ -90,46 +90,60 @@ pub fn read_config(configpath: &str) { } let config: Config = config.unwrap(); - println!("---------Setup Partitions---------"); - println!("{}", config.partition.device); - println!("{}", config.partition.mode); - println!("{}", config.partition.efi); + info(format!( + "Block device to use : /dev/{}", + config.partition.device + )); + info(format!("Partitioning mode : {}", config.partition.mode)); + info(format!("Partitioning for EFI : {}", config.partition.efi)); partition::partition( - config.partition.device.as_str(), + format!("/dev/{}", config.partition.device).as_str(), config.partition.mode.as_str(), config.partition.efi, ); base::install_base_packages(); base::genfstab(); - println!("---------Install Bootloader---------"); - println!("{}", config.bootloader.r#type); - println!("{}", config.bootloader.location); + println!(); + info(format!( + "Installing bootloader : {}", + config.bootloader.r#type + )); + info(format!( + "Installing bootloader to : {}", + config.bootloader.location + )); if config.bootloader.r#type == "grub-efi" { base::install_bootloader_efi(config.bootloader.location.as_str()); } else if config.bootloader.r#type == "grub-legacy" { base::install_bootloader_legacy(config.bootloader.location.as_str()); } - println!("---------Set Locale---------"); - println!("{:?}", config.locale.locale); - println!("{}", config.locale.keymap); - println!("{}", config.locale.timezone); + println!(); + info(format!("Adding Locales : {:?}", config.locale.locale)); + info(format!("Using keymap : {}", config.locale.keymap)); + info(format!("Setting timezone : {}", config.locale.timezone)); locale::set_locale(config.locale.locale.join(" ")); locale::set_keyboard(config.locale.keymap.as_str()); locale::set_timezone(config.locale.timezone.as_str()); - println!("---------Set Networking---------"); - println!("{}", config.networking.hostname); - println!("{}", config.networking.ipv6); + println!(); + info(format!("Hostname : {}", config.networking.hostname)); + info(format!("Enabling ipv6 : {}", config.networking.ipv6)); network::set_hostname(config.networking.hostname.as_str()); network::create_hosts(); if config.networking.ipv6 { network::enable_ipv6(); } - println!("---------Create Users---------"); + println!(); println!("---------"); for i in 0..config.users.len() { - println!("{}", config.users[i].name); - println!("{}", config.users[i].password); - println!("{}", config.users[i].hasroot); + info(format!("Creating user : {}", config.users[i].name)); + info(format!( + "Setting use password : {}", + config.users[i].password + )); + info(format!( + "Enabling root for user : {}", + config.users[i].hasroot + )); users::new_user( config.users[i].name.as_str(), config.users[i].hasroot, @@ -137,19 +151,20 @@ pub fn read_config(configpath: &str) { ); println!("---------"); } - println!("---------Set Rootpass---------"); - println!("{}", config.rootpass); + println!(); + info(format!("Setting root password : {}", config.rootpass)); users::root_pass(config.rootpass.as_str()); - println!("---------Install Desktop---------"); - println!("{}", config.desktop); - desktops::choose_pkgs(config.desktop.as_str()); - println!("---------Setup Timeshift---------"); - println!("{}", config.timeshift); + println!(); + info(format!("Installing desktop : {}", config.desktop)); + if config.desktop == "none" || config.desktop.is_empty() { + desktops::choose_pkgs(config.desktop.as_str()); + } + println!(); + info(format!("Enabling timeshift : {}", config.timeshift)); if config.timeshift { base::setup_timeshift(); } - println!("---------Install Extra packages---------"); - println!("{:?}", config.extra_packages); + info(format!("Extra packages : {:?}", config.extra_packages)); let mut extra_packages: Vec<&str> = Vec::new(); for i in 0..config.extra_packages.len() { extra_packages.push(config.extra_packages[i].as_str()); diff --git a/src/internal/mod.rs b/src/internal/mod.rs index b527384..02081a3 100755 --- a/src/internal/mod.rs +++ b/src/internal/mod.rs @@ -17,6 +17,9 @@ pub fn log(a: String) { strings::log(a); } +pub fn info(a: String) { + strings::info(a); +} pub fn files_eval(returncode: std::result::Result<(), std::io::Error>, logmsg: &str) { returncode_eval::files_eval(returncode, logmsg); } diff --git a/src/internal/returncode_eval.rs b/src/internal/returncode_eval.rs index a60d9b6..dec9b76 100755 --- a/src/internal/returncode_eval.rs +++ b/src/internal/returncode_eval.rs @@ -10,7 +10,7 @@ pub fn exec_eval( } Err(e) => { crash( - format!("{} ERROR: {}", logmsg, e), + format!("[ \x1b[2;1;32mFAILED\x1b[0m ] {} ERROR: {}", logmsg, e), return_code.unwrap_err().raw_os_error().unwrap(), ); } @@ -24,7 +24,7 @@ pub fn files_eval(return_code: std::result::Result<(), std::io::Error>, logmsg: } Err(e) => { crash( - format!("{} ERROR: {}", logmsg, e), + format!("[ \x1b[2;1;32mFAILED\x1b[0m ] {} ERROR: {}", logmsg, e), return_code.unwrap_err().raw_os_error().unwrap(), ); } diff --git a/src/internal/strings.rs b/src/internal/strings.rs index 3dc4317..2704632 100755 --- a/src/internal/strings.rs +++ b/src/internal/strings.rs @@ -10,7 +10,7 @@ pub fn crash(a: String, b: i32) { } else { a }; - println!("[ \x1b[2;1;32mOK\x1b[0m ] {}", a); + println!("{}", a); exit(b); } pub fn log(a: String) { @@ -22,7 +22,22 @@ pub fn log(a: String) { a }; eprintln!( - "{} {}", + "[ \x1b[2;1;33mLOG\x1b[0m ] {} {}", + std::time::SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_secs(), + a + ); +} +pub fn info(a: String) { + let a = if env::var("JADE_UWU").unwrap_or_else(|_| "".to_string()) == "true" { + uwu!(&a) + } else { + a + }; + eprintln!( + "[ \x1b[2;1;39mINFO\x1b[0m ] {} {}", std::time::SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap()