parent
30e2db26ca
commit
beae6be5cf
1 changed files with 12 additions and 10 deletions
|
@ -12,10 +12,18 @@ pub fn format_drives(conf: &DriveConfig) {
|
|||
// ROOT
|
||||
if let Some(pass) = &conf.encryption {
|
||||
run_command(
|
||||
&["cryptsetup", "luksFormat", conf.root.as_str()],
|
||||
Some(&format!("YES\n{pass}\n{pass}\n")),
|
||||
true,
|
||||
&["cryptsetup", "-q", "luksFormat", conf.root.as_str()],
|
||||
Some(&format!("{pass}\n")),
|
||||
false,
|
||||
);
|
||||
|
||||
run_command(
|
||||
&["cryptsetup", "open", conf.root.as_str(), "root"],
|
||||
Some(&format!("{pass}\n")),
|
||||
false,
|
||||
);
|
||||
|
||||
run_command(&["mkfs.ext4", "/dev/mapper/root"], None, false);
|
||||
} else {
|
||||
run_command(&["mkfs.ext4", conf.root.as_str()], None, false);
|
||||
}
|
||||
|
@ -25,13 +33,7 @@ pub fn format_drives(conf: &DriveConfig) {
|
|||
|
||||
/// Mount the drives at `/mnt`
|
||||
pub fn mount_drives(conf: &DriveConfig) {
|
||||
if let Some(pass) = &conf.encryption {
|
||||
run_command(
|
||||
&["cryptsetup", "open", conf.root.as_str(), "root"],
|
||||
Some(&format!("{pass}\n")),
|
||||
true,
|
||||
);
|
||||
|
||||
if conf.encryption.is_some() {
|
||||
run_command(&["mount", "/dev/mapper/root", "/mnt"], None, false);
|
||||
} else {
|
||||
run_command(&["mount", conf.root.as_str(), "/mnt"], None, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue