refactor
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2025-01-04 21:37:49 +01:00
parent bc69d74ac2
commit 30e2db26ca
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
18 changed files with 257 additions and 337 deletions

View file

@ -13,6 +13,7 @@ use kernel::setup_mkinitcpio;
use navos::setup_navos;
use ollama::setup_ollama;
use security::{setup_secure_boot, setup_tpm_unlock};
use skel::setup_skel;
use ssh::setup_ssh;
use user::setup_users;
use yansi::{Color, Paint};
@ -25,6 +26,7 @@ pub mod kernel;
pub mod navos;
pub mod ollama;
pub mod security;
pub mod skel;
pub mod ssh;
pub mod user;
pub mod zram;
@ -35,10 +37,6 @@ use crate::{
print_status,
};
pub fn str_vec(v: Vec<&str>) -> Vec<String> {
v.into_iter().map(|x| x.to_string()).collect()
}
pub fn uncomment_first_value_of(value: &str, file: &str) {
// read in the file
let content = std::fs::read_to_string(file).unwrap();
@ -49,7 +47,7 @@ pub fn uncomment_first_value_of(value: &str, file: &str) {
// uncomment the '#' symbol if there is one
for line in content.lines() {
if line.contains(value) && !found {
new.push_str(&format!("{}\n", line.replace("#", "")));
new.push_str(&format!("{}\n", line.replace('#', "")));
found = true;
} else {
new.push_str(&format!("{line}\n"));
@ -80,8 +78,8 @@ pub fn uncomment_tag(tag: &str, file: &str) {
pub fn install(conf: InstallConfig) {
// Drive Setup
format_drives(&conf.drive, conf.general.encryption);
mount_drives(&conf.drive, conf.general.encryption);
format_drives(&conf.drive);
mount_drives(&conf.drive);
// Base Install
pacstrap(&conf.pkg);
@ -89,9 +87,10 @@ pub fn install(conf: InstallConfig) {
// System Setup
first_boot_values(&conf.general);
setup_skel(&conf.general);
setup_users(&conf.user);
setup_ssh(&conf.ssh);
setup_ssh(conf.ssh);
setup_bootloader();
@ -135,7 +134,7 @@ pub fn install(conf: InstallConfig) {
setup_mkinitcpio(&conf.drive);
setup_secure_boot();
if conf.general.encryption {
if conf.drive.encryption.is_some() {
setup_tpm_unlock(&conf.drive);
}