mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-25 22:49:28 +02:00
Don't set the crypt hook when unnecessary (fix #20)
This commit is contained in:
parent
4b7547a57e
commit
e339b722df
28
src/initcpio.rs
Normal file
28
src/initcpio.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use std::fmt::Write;
|
||||
|
||||
pub struct Initcpio {
|
||||
encrypted: bool,
|
||||
}
|
||||
|
||||
impl Initcpio {
|
||||
pub fn new(encrypted: bool) -> Self {
|
||||
Self { encrypted }
|
||||
}
|
||||
|
||||
pub fn to_config(&self) -> String {
|
||||
let mut output = String::from(
|
||||
"MODULES=()
|
||||
BINARIES=()
|
||||
FILES=()
|
||||
HOOKS=(base udev keyboard consolefont block ",
|
||||
);
|
||||
|
||||
if self.encrypted {
|
||||
output.write_str("encrypt ").unwrap();
|
||||
}
|
||||
|
||||
output.write_str("filesystems keyboard fsck)\n").unwrap();
|
||||
|
||||
output
|
||||
}
|
||||
}
|
13
src/main.rs
13
src/main.rs
@ -1,5 +1,6 @@
|
||||
mod args;
|
||||
mod error;
|
||||
mod initcpio;
|
||||
mod presets;
|
||||
mod process;
|
||||
mod storage;
|
||||
@ -30,11 +31,6 @@ use tempfile::tempdir;
|
||||
const BOOT_PARTITION_INDEX: u8 = 1;
|
||||
const ROOT_PARTITION_INDEX: u8 = 3;
|
||||
|
||||
static MKINITCPIO: &'static str = "MODULES=()
|
||||
BINARIES=()
|
||||
FILES=()
|
||||
HOOKS=(base udev keyboard consolefont block encrypt filesystems keyboard fsck)";
|
||||
|
||||
static JOURNALD_CONF: &'static str = "
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
@ -313,8 +309,11 @@ fn create(command: CreateCommand, running: Arc<AtomicBool>) -> Result<(), Error>
|
||||
.run(ErrorKind::Locale)?;
|
||||
|
||||
info!("Generating initramfs");
|
||||
fs::write(mount_point.path().join("etc/mkinitcpio.conf"), MKINITCPIO)
|
||||
.context(ErrorKind::Initramfs)?;
|
||||
fs::write(
|
||||
mount_point.path().join("etc/mkinitcpio.conf"),
|
||||
initcpio::Initcpio::new(encrypted_root.is_some()).to_config(),
|
||||
)
|
||||
.context(ErrorKind::Initramfs)?;
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
|
Loading…
x
Reference in New Issue
Block a user