alma/src/initcpio.rs
Philip Mueller 979d30162f [src] update initcpio
- count in plymouth
2023-06-23 19:05:40 +02:00

37 lines
744 B
Rust

use std::fmt::Write;
pub struct Initcpio {
encrypted: bool,
plymouth: bool,
}
impl Initcpio {
pub fn new(encrypted: bool, plymouth: bool) -> Self {
Self {
encrypted,
plymouth,
}
}
pub fn to_config(&self) -> anyhow::Result<String> {
let mut output = String::from(
"MODULES=()
BINARIES=()
FILES=()
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block ",
);
if self.encrypted {
output.write_str("encrypt ")?;
}
if self.plymouth {
output.write_str("filesystems plymouth)\n")?;
} else {
output.write_str("filesystems fsck)\n")?;
}
Ok(output)
}
}