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