feat: Default to no owner for rsync (#2230)

This commit is contained in:
J H
2023-03-17 12:09:13 -06:00
committed by GitHub
parent 9fc0164c4d
commit eb5f7f64ad
3 changed files with 9 additions and 0 deletions

View File

@@ -429,6 +429,7 @@ async fn migrate(
ignore_existing: false, ignore_existing: false,
exclude: Vec::new(), exclude: Vec::new(),
no_permissions: false, no_permissions: false,
no_owner: false,
}, },
) )
.await?; .await?;
@@ -441,6 +442,7 @@ async fn migrate(
ignore_existing: false, ignore_existing: false,
exclude: vec!["tmp".to_owned()], exclude: vec!["tmp".to_owned()],
no_permissions: false, no_permissions: false,
no_owner: false,
}, },
) )
.await?; .await?;

View File

@@ -306,6 +306,7 @@ async fn sync_boot() -> Result<(), Error> {
ignore_existing: false, ignore_existing: false,
exclude: Vec::new(), exclude: Vec::new(),
no_permissions: false, no_permissions: false,
no_owner: false,
}, },
) )
.await? .await?

View File

@@ -23,6 +23,8 @@ pub struct RsyncOptions {
pub exclude: Vec<String>, pub exclude: Vec<String>,
#[serde(default = "const_true")] #[serde(default = "const_true")]
pub no_permissions: bool, pub no_permissions: bool,
#[serde(default = "const_true")]
pub no_owner: bool,
} }
impl Default for RsyncOptions { impl Default for RsyncOptions {
fn default() -> Self { fn default() -> Self {
@@ -32,6 +34,7 @@ impl Default for RsyncOptions {
ignore_existing: false, ignore_existing: false,
exclude: Vec::new(), exclude: Vec::new(),
no_permissions: false, no_permissions: false,
no_owner: false,
} }
} }
} }
@@ -61,6 +64,9 @@ impl Rsync {
if options.no_permissions { if options.no_permissions {
cmd.arg("--no-perms"); cmd.arg("--no-perms");
} }
if options.no_owner {
cmd.arg("--no-owner");
}
for exclude in options.exclude { for exclude in options.exclude {
cmd.arg(format!("--exclude={}", exclude)); cmd.arg(format!("--exclude={}", exclude));
} }