diff --git a/src/initcpio.rs b/src/initcpio.rs index 406bd06..9531cde 100644 --- a/src/initcpio.rs +++ b/src/initcpio.rs @@ -2,11 +2,15 @@ use std::fmt::Write; pub struct Initcpio { encrypted: bool, + plymouth: bool, } impl Initcpio { - pub fn new(encrypted: bool) -> Self { - Self { encrypted } + pub fn new(encrypted: bool, plymouth: bool) -> Self { + Self { + encrypted, + plymouth, + } } pub fn to_config(&self) -> anyhow::Result { @@ -14,14 +18,18 @@ impl Initcpio { "MODULES=() BINARIES=() FILES=() -HOOKS=(base udev keyboard consolefont block ", +HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block ", ); if self.encrypted { 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) } diff --git a/src/main.rs b/src/main.rs index d288f40..f11912e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -425,9 +425,10 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> { .context("Failed to write to journald.conf")?; info!("Generating initramfs"); + let plymouth_exists = Path::new(&mount_point.path().join("usr/bin/plymouth")).exists(); fs::write( 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")?; arch_chroot