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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2E8AF939D9 for ; Tue, 6 Feb 2024 12:33:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1C2B8329A3 for ; Tue, 6 Feb 2024 12:33:38 +0100 (CET) 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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 6 Feb 2024 12:33:36 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 69A194490A for ; Tue, 6 Feb 2024 12:33:36 +0100 (CET) Date: Tue, 6 Feb 2024 12:33:35 +0100 From: Christoph Heiss To: Proxmox VE development discussion Message-ID: References: <20240123170053.490250-1-a.lauterer@proxmox.com> <20240123170053.490250-15-a.lauterer@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240123170053.490250-15-a.lauterer@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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. [proxmox-fetch-answer.rs, partition.rs, proxmox.com] Subject: Re: [pve-devel] [PATCH v1 installer 14/18] auto-installer: add fetch answer binary X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2024 11:33:38 -0000 On Tue, Jan 23, 2024 at 06:00:49PM +0100, Aaron Lauterer wrote: > [..] > diff --git a/proxmox-auto-installer/src/bin/proxmox-fetch-answer.rs b/proxmox-auto-installer/src/bin/proxmox-fetch-answer.rs > new file mode 100644 > index 0000000..baf2bd2 > --- /dev/null > +++ b/proxmox-auto-installer/src/bin/proxmox-fetch-answer.rs > @@ -0,0 +1,73 @@ [..] > +fn main() -> ExitCode { > + if let Err(err) = init_log() { > + panic!("could not initilize logging: {err}"); > + } > + > + info!("Fetching answer file"); > + let answer = match fetch_answer() { > + Ok(answer) => answer, > + Err(err) => { > + error!("Aborting: {}", err); > + return ExitCode::FAILURE; > + } > + }; > + > + let mut child = match Command::new("/usr/bin/proxmox-auto-installer") Is relaying on hard-coded paths necessary here? Just using "proxmox-auto-installer" should work fine too, as `Command` searches in $PATH anyway for relative paths. [..] > diff --git a/proxmox-auto-installer/src/fetch_plugins/partition.rs b/proxmox-auto-installer/src/fetch_plugins/partition.rs > new file mode 100644 > index 0000000..0552ddd > --- /dev/null > +++ b/proxmox-auto-installer/src/fetch_plugins/partition.rs > @@ -0,0 +1,102 @@ [..] > + /// Will mount source path to ANSWER_MP > + /// > + /// # Arguments > + /// > + /// * `source` - `PathBuf` of the source location > + fn mount_part(source: PathBuf) -> Result<()> { > + info!("Mounting partition at {ANSWER_MP}"); > + // create dir for mountpoint > + match Command::new("/usr/bin/mkdir") > + .arg(ANSWER_MP) > + .arg("-p") > + .output() > + { > + Ok(output) => { > + if !output.status.success() { > + warn!( > + "Error creating mount path: {}", > + String::from_utf8(output.stderr)? > + ) > + } > + } > + Err(err) => bail!("Error creating mount path: {}", err), > + } This can replaced with a `std::fs::create_dir_all(ANSWER_MP)?`. But if nothing else major turns up, cleaning it (both) up as a follow-up patch is fine too I'd say - since it is a rather big series. > + match Command::new("/usr/bin/mount") ^ Same as proxmox-auto-installer [..] > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > >