From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E7B8F8A302 for ; Tue, 16 Aug 2022 11:27:25 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D47D51AA97 for ; Tue, 16 Aug 2022 11:26:55 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 16 Aug 2022 11:26:54 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9269E4331C for ; Tue, 16 Aug 2022 11:20:02 +0200 (CEST) From: Markus Frank To: pbs-devel@lists.proxmox.com Date: Tue, 16 Aug 2022 11:19:29 +0200 Message-Id: <20220816091929.26309-4-m.frank@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220816091929.26309-1-m.frank@proxmox.com> References: <20220816091929.26309-1-m.frank@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.087 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs] Subject: [pbs-devel] [PATCH proxmox-backup 3/3] added ignore-acl/xattr/ownership & overwrite parameter to proxmox-backup-client X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 09:27:25 -0000 If ignore-acl/ignore-xattr/ignore-ownership is set, the corresponding flag gets removed. overwrite-existing-files is saved as an PxarExtractOption like allow-existing-dirs. Signed-off-by: Markus Frank --- proxmox-backup-client/src/main.rs | 40 ++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 4bb9aa5e..20c29e26 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -1201,6 +1201,26 @@ We do not extract '.pxar' archives when writing to standard output. type: CryptMode, optional: true, }, + "ignore-ownership": { + type: Boolean, + description: "ignore owner settings", + optional: true, + }, + "ignore-acl": { + type: Boolean, + description: "ignore acl errors", + optional: true, + }, + "ignore-xattr": { + type: Boolean, + description: "ignore xattr errors", + optional: true, + }, + "overwrite-existing-files": { + type: Boolean, + description: "overwrite existing files", + optional: true, + }, } } )] @@ -1210,6 +1230,11 @@ async fn restore(param: Value) -> Result { 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_xattrs = param["ignore-xattr"].as_bool().unwrap_or(false); + let ignore_ownership = param["ignore-ownership"].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 +1356,27 @@ async fn restore(param: Value) -> Result { 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_ownership { + feature_flags.remove(pbs_client::pxar::Flags::WITH_PERMISSIONS); + } + 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 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