Rename volume-encrypt to encrypt

This commit is contained in:
Ana Hobden 2022-11-02 09:16:21 -07:00
parent e079f3ade0
commit 5cf3ce93b9

View file

@ -23,9 +23,9 @@ pub struct DarwinMulti {
long, long,
action(ArgAction::SetTrue), action(ArgAction::SetTrue),
default_value = "false", default_value = "false",
env = "HARMONIC_VOLUME_ENCRYPT" env = "HARMONIC_ENCRYPT"
)] )]
pub volume_encrypt: bool, pub encrypt: bool,
/// Use a case sensitive volume /// Use a case sensitive volume
#[clap( #[clap(
long, long,
@ -58,7 +58,7 @@ impl Planner for DarwinMulti {
settings: CommonSettings::default()?, settings: CommonSettings::default()?,
root_disk: Some(default_root_disk().await?), root_disk: Some(default_root_disk().await?),
case_sensitive: false, case_sensitive: false,
volume_encrypt: false, encrypt: false,
volume_label: "Nix Store".into(), volume_label: "Nix Store".into(),
}) })
} }
@ -81,8 +81,8 @@ impl Planner for DarwinMulti {
}, },
}; };
if self.volume_encrypt == false { if self.encrypt == false {
self.volume_encrypt = Command::new("/usr/bin/fdesetup") self.encrypt = Command::new("/usr/bin/fdesetup")
.arg("isactive") .arg("isactive")
.status() .status()
.await? .await?
@ -103,7 +103,7 @@ impl Planner for DarwinMulti {
self.root_disk.unwrap(), /* We just ensured it was populated */ self.root_disk.unwrap(), /* We just ensured it was populated */
self.volume_label, self.volume_label,
false, false,
self.volume_encrypt, self.encrypt,
) )
.await?, .await?,
), ),
@ -121,7 +121,7 @@ impl Planner for DarwinMulti {
) -> Result<HashMap<String, serde_json::Value>, Box<dyn std::error::Error + Sync + Send>> { ) -> Result<HashMap<String, serde_json::Value>, Box<dyn std::error::Error + Sync + Send>> {
let Self { let Self {
settings, settings,
volume_encrypt, encrypt,
volume_label, volume_label,
case_sensitive, case_sensitive,
root_disk, root_disk,
@ -129,10 +129,7 @@ impl Planner for DarwinMulti {
let mut map = HashMap::default(); let mut map = HashMap::default();
map.extend(settings.describe()?.into_iter()); map.extend(settings.describe()?.into_iter());
map.insert( map.insert("volume_encrypt".into(), serde_json::to_value(encrypt)?);
"volume_encrypt".into(),
serde_json::to_value(volume_encrypt)?,
);
map.insert("volume_label".into(), serde_json::to_value(volume_label)?); map.insert("volume_label".into(), serde_json::to_value(volume_label)?);
map.insert("root_disk".into(), serde_json::to_value(root_disk)?); map.insert("root_disk".into(), serde_json::to_value(root_disk)?);
map.insert( map.insert(