|
|
@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
mod installer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crate::installer::*;
|
|
|
|
use clap::{App, Arg, SubCommand};
|
|
|
|
use clap::{App, Arg, SubCommand};
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
fn main() {
|
|
|
@ -10,20 +13,13 @@ fn main() {
|
|
|
|
.arg(
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("mode")
|
|
|
|
Arg::with_name("mode")
|
|
|
|
.help("If jade should automatically partition (mode = auto) or the user manually partitioned it (mode = manual)")
|
|
|
|
.help("If jade should automatically partition (mode = auto) or the user manually partitioned it (mode = manual)")
|
|
|
|
|
|
|
|
.possible_values(&["auto", "manual"])
|
|
|
|
.required(true),
|
|
|
|
.required(true),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("root")
|
|
|
|
Arg::with_name("device")
|
|
|
|
.help("The root partition(mode = manual) or device to partition(mode = manual)")
|
|
|
|
.help("The device to partition")
|
|
|
|
.required(true),
|
|
|
|
.required_if("mode", "auto"),
|
|
|
|
)
|
|
|
|
|
|
|
|
.arg(
|
|
|
|
|
|
|
|
Arg::with_name("boot")
|
|
|
|
|
|
|
|
.help("The boot partition to use (only read if mode is manual)")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.arg(
|
|
|
|
|
|
|
|
Arg::with_name("swap")
|
|
|
|
|
|
|
|
.help("The swap partition to use (only read if mode is manual)")
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.subcommand(
|
|
|
|
.subcommand(
|
|
|
@ -55,11 +51,6 @@ fn main() {
|
|
|
|
.help("The hostname to use")
|
|
|
|
.help("The hostname to use")
|
|
|
|
.required(true),
|
|
|
|
.required(true),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
|
|
|
|
Arg::with_name("wifi")
|
|
|
|
|
|
|
|
.help("If wifi is used (will launch nmtui if set to true)")
|
|
|
|
|
|
|
|
.required(true),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.arg(
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("ipv6")
|
|
|
|
Arg::with_name("ipv6")
|
|
|
|
.help("Wether ipv6 should be enabled")
|
|
|
|
.help("Wether ipv6 should be enabled")
|
|
|
@ -87,6 +78,7 @@ fn main() {
|
|
|
|
.help("The password to set")
|
|
|
|
.help("The password to set")
|
|
|
|
.required(true),
|
|
|
|
.required(true),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
.subcommand(
|
|
|
|
.subcommand(
|
|
|
|
SubCommand::with_name("rootPass")
|
|
|
|
SubCommand::with_name("rootPass")
|
|
|
|
.about("Set the root password")
|
|
|
|
.about("Set the root password")
|
|
|
@ -96,7 +88,6 @@ fn main() {
|
|
|
|
.required(true),
|
|
|
|
.required(true),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.subcommand(
|
|
|
|
.subcommand(
|
|
|
|
SubCommand::with_name("desktops")
|
|
|
|
SubCommand::with_name("desktops")
|
|
|
@ -120,20 +111,7 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(app) = app.subcommand_matches("partition") {
|
|
|
|
if let Some(app) = app.subcommand_matches("partition") {
|
|
|
|
let mode = app.value_of("mode").unwrap();
|
|
|
|
partition::partition(app.value_of("device").unwrap(), app.value_of("mode").unwrap());
|
|
|
|
let root = app.value_of("root").unwrap_or("none");
|
|
|
|
|
|
|
|
let boot = app.value_of("boot").unwrap_or(root);
|
|
|
|
|
|
|
|
let swap = app.value_of("swap").unwrap_or("none");
|
|
|
|
|
|
|
|
let device = if app.value_of("mode").unwrap() == "auto" {
|
|
|
|
|
|
|
|
root
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
"none"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
println!("mode: {}", mode);
|
|
|
|
|
|
|
|
println!("root: {}", root);
|
|
|
|
|
|
|
|
println!("boot: {}", boot);
|
|
|
|
|
|
|
|
println!("swap: {}", swap);
|
|
|
|
|
|
|
|
println!("device: {}", device);
|
|
|
|
|
|
|
|
} else if let Some(app) = app.subcommand_matches("locale") {
|
|
|
|
} else if let Some(app) = app.subcommand_matches("locale") {
|
|
|
|
let kbrlayout = app.value_of("keyboard").unwrap();
|
|
|
|
let kbrlayout = app.value_of("keyboard").unwrap();
|
|
|
|
let timezn = app.value_of("timezone").unwrap();
|
|
|
|
let timezn = app.value_of("timezone").unwrap();
|
|
|
@ -142,31 +120,18 @@ fn main() {
|
|
|
|
println!("timezone: {}", timezn);
|
|
|
|
println!("timezone: {}", timezn);
|
|
|
|
println!("locales: {:?}", locale);
|
|
|
|
println!("locales: {:?}", locale);
|
|
|
|
} else if let Some(app) = app.subcommand_matches("networking") {
|
|
|
|
} else if let Some(app) = app.subcommand_matches("networking") {
|
|
|
|
let hostname = app.value_of("hostname").unwrap();
|
|
|
|
network::enable_ipv6(app.value_of("ipv6").unwrap().parse::<bool>().unwrap());
|
|
|
|
let wifi = app.value_of("wifi").unwrap();
|
|
|
|
network::set_hostname(app.value_of("hostname").unwrap())
|
|
|
|
let ipv6 = app.value_of("ipv6").unwrap();
|
|
|
|
|
|
|
|
println!("hostname: {}", hostname);
|
|
|
|
|
|
|
|
println!("wifi: {}", wifi);
|
|
|
|
|
|
|
|
println!("ipv6: {}", ipv6);
|
|
|
|
|
|
|
|
} else if let Some(app) = app.subcommand_matches("users") {
|
|
|
|
} else if let Some(app) = app.subcommand_matches("users") {
|
|
|
|
if let Some(app) = app.subcommand_matches("newUser") {
|
|
|
|
if let Some(app) = app.subcommand_matches("newUser") {
|
|
|
|
let username = app.value_of("username").unwrap();
|
|
|
|
users::new_user(app.value_of("username").unwrap(), app.value_of("hasroot").unwrap().parse::<bool>().unwrap(), app.value_of("password").unwrap());
|
|
|
|
let hasroot = app.value_of("hasroot").unwrap();
|
|
|
|
|
|
|
|
let password = app.value_of("password").unwrap();
|
|
|
|
|
|
|
|
println!("username: {}", username);
|
|
|
|
|
|
|
|
println!("hasroot: {}", hasroot);
|
|
|
|
|
|
|
|
println!("password: {}", password);
|
|
|
|
|
|
|
|
} else if let Some(app) = app.subcommand_matches("rootPass") {
|
|
|
|
} else if let Some(app) = app.subcommand_matches("rootPass") {
|
|
|
|
let rootpass = app.value_of("rootPass").unwrap();
|
|
|
|
let rootpass = app.value_of("rootPass").unwrap();
|
|
|
|
println!("{}", rootpass);
|
|
|
|
println!("{}", rootpass);
|
|
|
|
|
|
|
|
users::root_pass(app.value_of("rootPass").unwrap());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if let Some(app) = app.subcommand_matches("desktops") {
|
|
|
|
} else if let Some(app) = app.subcommand_matches("desktops") {
|
|
|
|
let desktopsetup = app.value_of("desktopsetup").unwrap();
|
|
|
|
desktops::choose_pkgs(app.value_of("desktopsetup").unwrap(), app.value_of("de").unwrap_or("none"), app.value_of("dm").unwrap_or("none"));
|
|
|
|
let de = app.value_of("de").unwrap_or("none");
|
|
|
|
|
|
|
|
let dm = app.value_of("dm").unwrap_or("none");
|
|
|
|
|
|
|
|
println!("desktopsetup: {}", desktopsetup);
|
|
|
|
|
|
|
|
println!("de: {}", de);
|
|
|
|
|
|
|
|
println!("dm: {}", dm);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
println!("Running TUI installer");
|
|
|
|
println!("Running TUI installer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|