update
This commit is contained in:
parent
d6042bc2e1
commit
44a88c9584
6 changed files with 228 additions and 167 deletions
40
src/create_iso.rs
Normal file
40
src/create_iso.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use crate::{install::str_vec, is_root, run_command};
|
||||
|
||||
// TODO : Make GUI in install medium optional with arg `--with-gui`
|
||||
pub fn create_iso() {
|
||||
if !is_root() {
|
||||
eprintln!("Error: You need root to create an ISO");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
if !std::fs::exists("./iso").unwrap() {
|
||||
let cmd = str_vec(vec!["git", "clone", "https://git.hydrar.de/navos/iso"]);
|
||||
run_command(&cmd, None, false);
|
||||
}
|
||||
|
||||
std::fs::create_dir_all("./work").unwrap();
|
||||
|
||||
let mount_cmd = str_vec(vec![
|
||||
"mount", "-t", "tmpfs", "-o", "size=10G", "tmpfs", "./work",
|
||||
]);
|
||||
|
||||
run_command(&mount_cmd, None, false);
|
||||
|
||||
let mkarchiso_cmd = vec![
|
||||
"mkarchiso".to_string(),
|
||||
"-v".to_string(),
|
||||
"-w".to_string(),
|
||||
"./work".to_string(),
|
||||
"-o".to_string(),
|
||||
"./".to_string(),
|
||||
"./iso".to_string(),
|
||||
];
|
||||
|
||||
run_command(&mkarchiso_cmd, None, true);
|
||||
|
||||
let umount_cmd = str_vec(vec!["umount", "-r", "./work"]);
|
||||
|
||||
run_command(&umount_cmd, None, false);
|
||||
|
||||
std::fs::remove_dir_all("./work").unwrap();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue