From f73a6cfd5c57d68fde8a02d60180725f6b75e9fa Mon Sep 17 00:00:00 2001 From: JMARyA Date: Sat, 11 Jan 2025 21:41:04 +0100 Subject: [PATCH 1/4] fix --- src/install/ollama.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/install/ollama.rs b/src/install/ollama.rs index af5e79f..47ca27e 100644 --- a/src/install/ollama.rs +++ b/src/install/ollama.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use crate::{ config::OllamaConfig, linux::{arch_chroot, systemd_service_enable}, @@ -19,11 +21,13 @@ pub fn setup_ollama(conf: &OllamaConfig) { let mut ollama_server = std::process::Command::new("arch-chroot") .arg("/mnt") - .arg("runuser -u ollama -- env OLLAMA_MODELS=/var/lib/ollama HOME=/var/lib/ollama /usr/bin/ollama serve") + .arg("/bin/runuser -u ollama -- env OLLAMA_MODELS=/var/lib/ollama HOME=/var/lib/ollama /usr/bin/ollama serve") .stdout(std::process::Stdio::piped()) .spawn() .expect("Failed to start ollama server"); + std::thread::sleep(Duration::from_secs(5)); + let models = conf.models.clone().unwrap_or_default(); for model in models { From 5884c6ca8fa74af6b8284b25679bf4dbceead488 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 13 Jan 2025 13:25:44 +0100 Subject: [PATCH 2/4] fix --- src/install/security.rs | 8 ++++++-- src/main.rs | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/install/security.rs b/src/install/security.rs index 33d525d..e063e78 100644 --- a/src/install/security.rs +++ b/src/install/security.rs @@ -49,8 +49,7 @@ pub fn setup_tpm_unlock(conf: &DriveConfig) { // SECURE BOOT -/// Setup Secure Boot on the system -pub fn setup_secure_boot() { +pub fn ensure_secure_boot() { let (stdout, _) = run_command(&["sbctl", "status"], None, false); let binding = stdout.lines().collect::>(); let status = binding.get(1).unwrap(); @@ -62,6 +61,11 @@ pub fn setup_secure_boot() { ); std::process::exit(1); } +} + +/// Setup Secure Boot on the system +pub fn setup_secure_boot() { + ensure_secure_boot(); install_pkgs(&["sbctl", "sbsigntools"]); diff --git a/src/main.rs b/src/main.rs index 986bd0e..f456913 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ mod linux; mod pkg; mod print; use create_iso::create_iso; -use install::install; +use install::{install, security::ensure_secure_boot}; use linux::is_root; use print::print_config; use yansi::{Color, Paint}; @@ -61,6 +61,8 @@ fn main() { std::process::exit(1); } + ensure_secure_boot(); + let config_file: &String = install_args.get_one("config").unwrap(); let force = install_args.get_flag("force"); let conf = read_conf(config_file); From 86cf3edb906439c0577f04c01ceca60f9a3ab0bd Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 17 Mar 2025 14:46:28 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 85 ++++++++++++++++++++++++--------------------- src/install/gpu.rs | 2 +- src/install/mod.rs | 7 ++++ src/install/virt.rs | 6 ++-- 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef13355..165bd3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,19 +43,20 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys", ] [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "cfg-if" @@ -71,18 +72,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.23" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstream", "anstyle", @@ -104,9 +105,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "hashbrown" @@ -116,9 +117,9 @@ checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "indexmap" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown", @@ -132,15 +133,15 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "memchr" @@ -173,43 +174,49 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "1.0.92" +name = "once_cell" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -218,9 +225,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.135" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -245,9 +252,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.91" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -256,9 +263,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -277,9 +284,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -290,9 +297,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "utf8parse" @@ -375,9 +382,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] diff --git a/src/install/gpu.rs b/src/install/gpu.rs index 9532dda..7ed6460 100644 --- a/src/install/gpu.rs +++ b/src/install/gpu.rs @@ -17,7 +17,7 @@ pub fn setup_video_drivers(vendor: &GPUVendor) { } GPUVendor::INTEL => { install_pkgs(&[ - "xf86-video-intel2", + "xf86-video-intel", "mesa", "lib32-mesa", "vulkan-intel", diff --git a/src/install/mod.rs b/src/install/mod.rs index b30de83..58a8650 100644 --- a/src/install/mod.rs +++ b/src/install/mod.rs @@ -1,5 +1,8 @@ // TODO : Autojoin docker swarm // TODO : Autojoin teleport +// TODO : Install CA certs +// TODO : Install node exporter +// TODO : ZFS? // DRIVE SELECTION @@ -42,6 +45,10 @@ pub mod user; pub mod virt; pub mod zram; +// TODO : error handling +// TODO : Power profile daemon +// TODO : Make zsh default + completions + use crate::{ config::InstallConfig, pkg::{self, install_pkgs, pacstrap}, diff --git a/src/install/virt.rs b/src/install/virt.rs index 2f75a68..584e96e 100644 --- a/src/install/virt.rs +++ b/src/install/virt.rs @@ -12,7 +12,7 @@ pub fn setup_virtualization(conf: &InstallConfig) { Vec::new() }; - install_pkgs(&["libvirt"]); + install_pkgs(&["libvirt", "swtpm", "qemu-base"]); if matches!(conf.general.mode, InstallMode::Desktop) { install_pkgs(&["virt-manager"]); @@ -34,9 +34,7 @@ pub fn setup_virtualization(conf: &InstallConfig) { /// Setup guest utils if running inside a VM pub fn setup_vm() { let res = run_command(&["systemd-detect-virt", "--vm"], None, false); - let is_vm = res - .0 - .trim(); + let is_vm = res.0.trim(); match is_vm { "qemu" | "kvm" => { From 1ff81b1915530f820fae0c3e465494889c5b7613 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 17 Mar 2025 14:49:29 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9C=A8=20option=20to=20not=20use=20tmpfs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/args.rs | 1 + src/create_iso.rs | 8 +++++--- src/main.rs | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/args.rs b/src/args.rs index 34b51ca..b61c4a2 100644 --- a/src/args.rs +++ b/src/args.rs @@ -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 "Create ISO with this keyboard layout")) .arg(arg!(--kb_variant "Create ISO with this keyboard layout variant")) .arg(arg!(--install "Create ISO which automatically installs upon boot.")) diff --git a/src/create_iso.rs b/src/create_iso.rs index 14dd5b2..894542f 100644 --- a/src/create_iso.rs +++ b/src/create_iso.rs @@ -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"]; diff --git a/src/main.rs b/src/main.rs index f456913..d3b44e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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", _)) => {