Add info output, make config output more pretty

axtloss/rework-partitioning
Amy 3 years ago
parent 41cc70d62a
commit 3cd7e5768f
No known key found for this signature in database
GPG Key ID: C642EA4B2F4096BE

@ -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

Binary file not shown.

@ -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);
println!();
info(format!("Installing desktop : {}", config.desktop));
if config.desktop == "none" || config.desktop.is_empty() {
desktops::choose_pkgs(config.desktop.as_str());
println!("---------Setup Timeshift---------");
println!("{}", config.timeshift);
}
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());

@ -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);
}

@ -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(),
);
}

@ -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()

Loading…
Cancel
Save