[pbs-devel] [PATCH proxmox-backup v2 3/3] proxmox-backup-client: added ignore-acl/xattr/ownership/permission & overwrite parameters
Markus Frank
m.frank at proxmox.com
Thu Aug 18 13:06:54 CEST 2022
If ignore-acl/ignore-xattr/ignore-ownership/ignore-permission is set,
the corresponding flag gets removed.
overwrite-existing-files is saved as an PxarExtractOption like
allow-existing-dirs.
Signed-off-by: Markus Frank <m.frank at proxmox.com>
---
v2: added ignore-permission
proxmox-backup-client/src/main.rs | 49 ++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 4bb9aa5e..dc038864 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1201,6 +1201,31 @@ We do not extract '.pxar' archives when writing to standard output.
type: CryptMode,
optional: true,
},
+ "ignore-acl": {
+ type: Boolean,
+ description: "ignore acl settings",
+ optional: true,
+ },
+ "ignore-xattr": {
+ type: Boolean,
+ description: "ignore xattr settings",
+ optional: true,
+ },
+ "ignore-ownership": {
+ type: Boolean,
+ description: "ignore owner settings (no chown)",
+ optional: true,
+ },
+ "ignore-permission": {
+ type: Boolean,
+ description: "ignore permission settings (no chmod)",
+ optional: true,
+ },
+ "overwrite-existing-files": {
+ type: Boolean,
+ description: "overwrite already existing files",
+ optional: true,
+ },
}
}
)]
@@ -1210,6 +1235,12 @@ async fn restore(param: Value) -> Result<Value, Error> {
let allow_existing_dirs = param["allow-existing-dirs"].as_bool().unwrap_or(false);
+ let ignore_acls = param["ignore-acl"].as_bool().unwrap_or(false);
+ let ignore_xattr = param["ignore-xattr"].as_bool().unwrap_or(false);
+ let ignore_ownership = param["ignore-ownership"].as_bool().unwrap_or(false);
+ let ignore_permission = param["ignore-permission"].as_bool().unwrap_or(false);
+ let overwrite_existing_files = param["overwrite-existing-files"].as_bool().unwrap_or(false);
+
let archive_name = json::required_string_param(¶m, "archive-name")?;
let rate = match param["rate"].as_str() {
@@ -1331,14 +1362,30 @@ async fn restore(param: Value) -> Result<Value, Error> {
match_list: &[],
extract_match_default: true,
allow_existing_dirs,
+ overwrite_existing_files,
on_error: None,
};
+ let mut feature_flags = pbs_client::pxar::Flags::DEFAULT;
+
+ if ignore_acls {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_ACL);
+ }
+ if ignore_xattr {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_XATTRS);
+ }
+ if ignore_ownership {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_OWNER);
+ }
+ if ignore_permission {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_PERMISSIONS);
+ }
+
if let Some(target) = target {
pbs_client::pxar::extract_archive(
pxar::decoder::Decoder::from_std(reader)?,
Path::new(target),
- pbs_client::pxar::Flags::DEFAULT,
+ feature_flags,
|path| {
log::debug!("{:?}", path);
},
--
2.30.2
More information about the pbs-devel
mailing list