From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8288E1FF171 for ; Fri, 13 Dec 2024 11:00:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 64A4CC650; Fri, 13 Dec 2024 11:00:43 +0100 (CET) Date: Fri, 13 Dec 2024 11:00:09 +0100 Message-Id: From: "Christoph Heiss" To: "Daniel Kral" Mime-Version: 1.0 X-Mailer: aerc 0.18.2 References: <20241211092436.69088-1-d.kral@proxmox.com> In-Reply-To: <20241211092436.69088-1-d.kral@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 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 Subject: Re: [pve-devel] [PATCH installer v2] auto: allow a binary executable as the first boot executable 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: , Reply-To: Proxmox VE development discussion Cc: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" LGTM. Tested with a shell script and a compiled binary, w/ and w/o sending the `Content-Length` header in the response. The "Automated Installation" page needs to be updated though, to reflect: a) that either shell-scripts or compiled binaries can be used and b) that the compiled binaries must be (obviously) x86_64 and best case statically linked, as there otherwise no guarantees that it will run on the target system and might just fail blindly. Please consider this patch: Tested-by: Christoph Heiss Reviewed-by: Christoph Heiss FWIW, just thinking out loud here: Maybe the fetching of the first-boot hook should be moved into `proxmox-fetch-answer` altogether. In a sense that `proxmox-fetch-answer` would fetch all the needed things in advance, such that the auto-installer, post-hook etc. doesn't have to do that anymore. But that's really not pressing of any kind, rather a long-term thing. On Wed Dec 11, 2024 at 10:24 AM CET, Daniel Kral wrote: > As the initial use case for the first boot feature request [0] was for > running shell scripts, the auto installer retrieved the binary as a > `String`. Unfortunately, this tries to interpret binary data as UTF-8 > and will transform 'invalid' characters to replacement characters [1]. > > This causes the auto-installer to create an invalid binary when fetching > from an URL, and error with a `stream did not contain valid UTF-8` error > when fetching from the ISO image. > > To allow binary executables to be used as a first boot executable, this > commit changes the fetching from being read as a `String` to being read > as a `Vec` to not interfere with the content of the executable. > > [0] https://bugzilla.proxmox.com/show_bug.cgi?id=5579 > [1] https://doc.rust-lang.org/src/alloc/string.rs.html#635 > > Signed-off-by: Daniel Kral > --- > changes from v1: > - remove explicit handling of `std::io::ErrorKind::UnexpectedEof` > > .../src/bin/proxmox-auto-installer.rs | 12 ++++++++---- > proxmox-installer-common/src/http.rs | 18 ++++++++++++++---- > 2 files changed, 22 insertions(+), 8 deletions(-) > [..] _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel