alma/src/initcpio.rs
2020-05-31 08:38:20 +03:00

29 lines
528 B
Rust

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