forked from lix-project/lix-installer
Use the right magic sauce in the mount command
This commit is contained in:
parent
997364ad41
commit
e079f3ade0
|
@ -80,26 +80,18 @@ impl CreateApfsVolume {
|
||||||
};
|
};
|
||||||
|
|
||||||
let name_with_qoutes = format!("\"{name}\"");
|
let name_with_qoutes = format!("\"{name}\"");
|
||||||
|
let encrypted_command;
|
||||||
let mount_command = if encrypt {
|
let mount_command = if encrypt {
|
||||||
vec![
|
encrypted_command = format!("/usr/bin/security find-generic-password -s {name_with_qoutes} -w | /usr/sbin/diskutil apfs unlockVolume {name_with_qoutes} -mountpoint /nix -stdinpassphrase");
|
||||||
"/bin/sh",
|
vec!["/bin/sh", "-c", encrypted_command.as_str()]
|
||||||
"-c",
|
|
||||||
"/usr/bin/security",
|
|
||||||
"find-generic-password",
|
|
||||||
"-s",
|
|
||||||
name_with_qoutes.as_str(),
|
|
||||||
"-w",
|
|
||||||
"|",
|
|
||||||
"/usr/sbin/diskutil",
|
|
||||||
"apfs",
|
|
||||||
"unlockVolume",
|
|
||||||
&name,
|
|
||||||
"-mountpoint",
|
|
||||||
"/nix",
|
|
||||||
"-stdinpassphrase",
|
|
||||||
]
|
|
||||||
} else {
|
} else {
|
||||||
vec!["/usr/sbin/diskutil", "mount", "-mountPoint", "/nix", &name]
|
vec![
|
||||||
|
"/usr/sbin/diskutil",
|
||||||
|
"mount",
|
||||||
|
"-mountPoint",
|
||||||
|
"/nix",
|
||||||
|
name_with_qoutes.as_str(),
|
||||||
|
]
|
||||||
};
|
};
|
||||||
// TODO(@hoverbear): Use plist lib we have in tree...
|
// TODO(@hoverbear): Use plist lib we have in tree...
|
||||||
let mount_plist = format!(
|
let mount_plist = format!(
|
||||||
|
|
|
@ -82,9 +82,10 @@ impl Planner for DarwinMulti {
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.volume_encrypt == false {
|
if self.volume_encrypt == false {
|
||||||
self.volume_encrypt = execute_command(Command::new("/usr/bin/fdesetup").arg("isactive"))
|
self.volume_encrypt = Command::new("/usr/bin/fdesetup")
|
||||||
|
.arg("isactive")
|
||||||
|
.status()
|
||||||
.await?
|
.await?
|
||||||
.status
|
|
||||||
.code()
|
.code()
|
||||||
.map(|v| if v == 0 { false } else { true })
|
.map(|v| if v == 0 { false } else { true })
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|
|
Loading…
Reference in a new issue