From: Markus Frank <m.frank@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v3 3/3] proxmox-backup-client: added ignore-acls/xattrs/ownership/permissions & overwrite parameters
Date: Fri, 19 Aug 2022 12:48:48 +0200 [thread overview]
Message-ID: <20220819104848.58076-4-m.frank@proxmox.com> (raw)
In-Reply-To: <20220819104848.58076-1-m.frank@proxmox.com>
If ignore-acls/ignore-xattrs/ignore-ownership/ignore-permissions is
set, the corresponding flag gets removed.
overwrite is saved as an PxarExtractOption like allow-existing-dirs.
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
v3:
* renamed parameters to plural form and changed to function parameters
* renamed overwrite-existing-files to overwrite
v2: added ignore-permissions
proxmox-backup-client/src/main.rs | 61 +++++++++++++++++++++++++++++--
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 4bb9aa5e..042802b4 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1188,6 +1188,7 @@ We do not extract '.pxar' archives when writing to standard output.
type: Boolean,
description: "Do not fail if directories already exists.",
optional: true,
+ default: false,
},
keyfile: {
schema: KEYFILE_SCHEMA,
@@ -1201,15 +1202,51 @@ We do not extract '.pxar' archives when writing to standard output.
type: CryptMode,
optional: true,
},
+ "ignore-acls": {
+ type: Boolean,
+ description: "ignore acl settings",
+ optional: true,
+ default: false,
+ },
+ "ignore-xattrs": {
+ type: Boolean,
+ description: "ignore xattr settings",
+ optional: true,
+ default: false,
+ },
+ "ignore-ownership": {
+ type: Boolean,
+ description: "ignore owner settings (no chown)",
+ optional: true,
+ default: false,
+ },
+ "ignore-permissions": {
+ type: Boolean,
+ description: "ignore permission settings (no chmod)",
+ optional: true,
+ default: false,
+ },
+ "overwrite": {
+ type: Boolean,
+ description: "overwrite already existing files",
+ optional: true,
+ default: false,
+ },
}
}
)]
/// Restore backup repository.
-async fn restore(param: Value) -> Result<Value, Error> {
+async fn restore(
+ param: Value,
+ allow_existing_dirs: bool,
+ ignore_acls: bool,
+ ignore_xattrs: bool,
+ ignore_ownership: bool,
+ ignore_permissions: bool,
+ overwrite: bool
+ ) -> Result<Value, Error> {
let repo = extract_repository_from_value(¶m)?;
- let allow_existing_dirs = param["allow-existing-dirs"].as_bool().unwrap_or(false);
-
let archive_name = json::required_string_param(¶m, "archive-name")?;
let rate = match param["rate"].as_str() {
@@ -1331,14 +1368,30 @@ async fn restore(param: Value) -> Result<Value, Error> {
match_list: &[],
extract_match_default: true,
allow_existing_dirs,
+ overwrite,
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_xattrs {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_XATTRS);
+ }
+ if ignore_ownership {
+ feature_flags.remove(pbs_client::pxar::Flags::WITH_OWNER);
+ }
+ if ignore_permissions {
+ 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
next prev parent reply other threads:[~2022-08-19 10:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 10:48 [pbs-devel] [PATCH proxmox-backup v3 0/3] pbs-client: feature #3923 Markus Frank
2022-08-19 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 1/3] pbs-client: added overwrite parameter to PxarExtractOptions Markus Frank
2022-08-19 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 2/3] pbs-client: added options to skip acls/xattrs/ownership/permissions Markus Frank
2022-08-19 10:48 ` Markus Frank [this message]
2022-08-19 11:43 ` [pbs-devel] applied series: [PATCH proxmox-backup v3 0/3] pbs-client: feature #3923 Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220819104848.58076-4-m.frank@proxmox.com \
--to=m.frank@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.