diff options
author | Alexander Bantyev | 2022-01-29 13:35:12 +0300 |
---|---|---|
committer | GitHub | 2022-01-29 13:35:12 +0300 |
commit | 3180b55ad44777edd90c08f9f9d4df74ec1549b9 (patch) | |
tree | 3ec4c68c7a2bb93baea99c91c272c592eac3447a /src/lib.rs | |
parent | 0ac333cdc03407538b5b19d60a8e7c64588490fb (diff) | |
parent | 874af9b05bec0bd73a333166a8b5291ecb1c0e3e (diff) |
Merge pull request #148 from afontaine/afontaine/add-doas-support
Add custom sudo command support
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -161,6 +161,7 @@ pub struct CmdOverrides { pub magic_rollback: Option<bool>, pub temp_path: Option<String>, pub confirm_timeout: Option<u16>, + pub sudo: Option<String>, pub dry_activate: bool, } @@ -350,7 +351,7 @@ impl<'a> DeployData<'a> { let profile_path = self.get_profile_path()?; let sudo: Option<String> = match self.merged_settings.user { - Some(ref user) if user != &ssh_user => Some(format!("sudo -u {}", user)), + Some(ref user) if user != &ssh_user => Some(format!("{} {}", self.get_sudo(), user)), _ => None, }; @@ -392,6 +393,13 @@ impl<'a> DeployData<'a> { }; Ok(profile_user) } + + fn get_sudo(&'a self) -> String { + return match self.merged_settings.sudo { + Some(ref x) => x.clone(), + None => "sudo -u".to_string() + }; + } } pub fn make_deploy_data<'a, 's>( |