This commit is contained in:
parent
49e838c45a
commit
98c83c5403
7 changed files with 53 additions and 28 deletions
24
src/main.rs
24
src/main.rs
|
@ -1,12 +1,22 @@
|
|||
use navinstall::config::InstallConfig;
|
||||
use navinstall::install::navos::setup_navos;
|
||||
use navinstall::install::{
|
||||
drives::setup_disk_image, install, install_mnt, security::ensure_secure_boot,
|
||||
};
|
||||
use navinstall::linux::is_root;
|
||||
use navinstall::pkg::pacstrap_at;
|
||||
use navinstall::print::print_config;
|
||||
use navinstall::print_status;
|
||||
use navinstall::{create_iso::create_iso, expect_yes};
|
||||
use yansi::{Color, Paint};
|
||||
|
||||
pub fn ensure_root() {
|
||||
if !is_root() {
|
||||
eprintln!("Error: You need root to install");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!(
|
||||
"{}",
|
||||
|
@ -53,9 +63,12 @@ fn main() {
|
|||
);
|
||||
std::process::exit(0);
|
||||
}
|
||||
Some(("create-tar", _)) => {
|
||||
println!("Tar creation is not yet supported");
|
||||
unimplemented!()
|
||||
Some(("create-tar", tar_options)) => {
|
||||
ensure_root();
|
||||
let dir: &String = tar_options.get_one("dir").unwrap();
|
||||
print_status("Pacstrapping root fs");
|
||||
pacstrap_at(&dir, None, &[]);
|
||||
setup_navos(dir.as_str());
|
||||
}
|
||||
Some(("create-img", install_args)) => {
|
||||
let config_file: &String = install_args.get_one("config").unwrap();
|
||||
|
@ -66,10 +79,7 @@ fn main() {
|
|||
install_mnt(conf, false);
|
||||
}
|
||||
Some(("install", install_args)) => {
|
||||
if !is_root() {
|
||||
eprintln!("Error: You need root to install");
|
||||
std::process::exit(1);
|
||||
}
|
||||
ensure_root();
|
||||
|
||||
let config_file: &String = install_args.get_one("config").unwrap();
|
||||
let force = install_args.get_flag("force");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue