option to not use tmpfs
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-03-17 14:49:29 +01:00
parent 86cf3edb90
commit 1ff81b1915
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 14 additions and 4 deletions

View file

@ -7,6 +7,7 @@ pub fn get_args() -> clap::ArgMatches {
command!("create-iso")
.about("Create a new installation medium ISO")
.arg(arg!(--without_gui "Create ISO with just terminal"))
.arg(arg!(--no_tmp "Create ISO on disk"))
.arg(arg!(--kb_layout <LAYOUT> "Create ISO with this keyboard layout"))
.arg(arg!(--kb_variant <VARIANT> "Create ISO with this keyboard layout variant"))
.arg(arg!(--install <CONFIG> "Create ISO which automatically installs <CONFIG> upon boot."))

View file

@ -15,6 +15,7 @@ pub fn build_kxkbrc(layout: &str, variant: Option<&str>) -> String {
pub fn create_iso(
without_gui: bool,
no_tmp: bool,
kb_layout: &str,
kb_variant: Option<&str>,
install: Option<&String>,
@ -59,9 +60,10 @@ pub fn create_iso(
std::fs::create_dir_all("./work").unwrap();
let mount_cmd = vec!["mount", "-t", "tmpfs", "-o", "size=10G", "tmpfs", "./work"];
run_command(&mount_cmd, None, false);
if !no_tmp {
let mount_cmd = vec!["mount", "-t", "tmpfs", "-o", "size=10G", "tmpfs", "./work"];
run_command(&mount_cmd, None, false);
}
let mkarchiso_cmd = vec!["mkarchiso", "-v", "-w", "./work", "-o", "./", "./iso"];

View file

@ -35,13 +35,20 @@ fn main() {
match args.subcommand() {
Some(("create-iso", iso_args)) => {
let without_gui = iso_args.get_flag("without_gui");
let no_tmp = iso_args.get_flag("no_tmp");
let kb_layout_default = "us".to_string();
let kb_layout: &String = iso_args.get_one("kb_layout").unwrap_or(&kb_layout_default);
let kb_variant: Option<&str> =
iso_args.get_one("kb_variant").map(|x: &String| x.as_str());
let auto_install_config: Option<&String> = iso_args.get_one("install");
create_iso(without_gui, kb_layout, kb_variant, auto_install_config);
create_iso(
without_gui,
no_tmp,
kb_layout,
kb_variant,
auto_install_config,
);
std::process::exit(0);
}
Some(("create-tar", _)) => {