mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-24 05:59:28 +02:00
37 lines
744 B
Rust
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)
|
|
}
|
|
}
|