[src] update initcpio

- count in plymouth
This commit is contained in:
Philip Mueller 2023-06-23 19:05:40 +02:00
parent af66a89067
commit 979d30162f
2 changed files with 14 additions and 5 deletions

View File

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

View File

@ -425,9 +425,10 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
.context("Failed to write to journald.conf")?; .context("Failed to write to journald.conf")?;
info!("Generating initramfs"); info!("Generating initramfs");
let plymouth_exists = Path::new(&mount_point.path().join("usr/bin/plymouth")).exists();
fs::write( fs::write(
mount_point.path().join("etc/mkinitcpio.conf"), mount_point.path().join("etc/mkinitcpio.conf"),
initcpio::Initcpio::new(encrypted_root.is_some()).to_config()?, initcpio::Initcpio::new(encrypted_root.is_some(), plymouth_exists).to_config()?,
) )
.context("Failed to write to mkinitcpio.conf")?; .context("Failed to write to mkinitcpio.conf")?;
arch_chroot arch_chroot