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 425A01FF15C for ; Wed, 13 Nov 2024 14:59:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6A5CA16846; Wed, 13 Nov 2024 14:59:22 +0100 (CET) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Wed, 13 Nov 2024 14:59:02 +0100 Message-ID: <20241113135908.1622968-1-c.heiss@proxmox.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 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: [pve-devel] [RFC PATCH installer 0/5] fix #5579: allow specifying optional first-boot script 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" This implements #5579 [0] as proposed by Thomas [1]. Sending it as an RFC as probably some bike-shedding has still to be done anyway, in regards of naming/filesystem locations etc. -- but should give an good idea how it can/should work in the end. Adds a new (optional) section to the auto-installer answer file called `first-boot`, which can be used to the configure a script/executable file to run on the first boot after the installation. To used the baked-in (via the `proxmox-auto-install-assistant prepare-iso --on-first-boot`) file from the ISO: [first-boot] source = "from-iso" Or fetching it from a URL: [first-boot] source = "from-url" url = "http://example.com/first-boot" cert_fingerprint = ".." # if needed The structure the section is mostly taken from the `network` section to provide consistency. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=5579 [1] https://bugzilla.proxmox.com/show_bug.cgi?id=5579#c5 Inner workings ============== This creates a new package `proxmox-first-boot`, which only has a systemd .service file. The service is conditioned to start based on the existence of a flag file in /var/lib/proxmox-first-boot, which will be created by the installer if such a script is supplied by the user. Q: The condition could maybe be set directly on the script instead of a separate file, since the executable file is only present when supplied anyway? Testing ======= Tested this with the latest (8.2-2) PVE ISO, both baking it into the ISO and fetching it from an URL. Did not test with PBS explicitly (yet), but I see no reason why it shouldn't work, as it is completely product-agnostic. Diffstat ======== Christoph Heiss (5): common: add function for issuing HTTP GET requests fix #5579: first-boot: add initial service packaging fix #5579: auto-install-assistant: enable baking in first-boot script fix #5579: auto-installer: add optional first-boot hook script fix #5579: install: copy over `proxmox-first-boot` script if present Makefile | 13 +++- Proxmox/Install.pm | 20 ++++++ debian/control | 7 ++ debian/proxmox-first-boot.install | 1 + debian/rules.proxmox-first-boot | 13 ++++ proxmox-auto-install-assistant/Cargo.toml | 1 + proxmox-auto-install-assistant/src/main.rs | 17 +++++ proxmox-auto-installer/Cargo.toml | 2 +- proxmox-auto-installer/src/answer.rs | 27 +++++++ .../src/bin/proxmox-auto-installer.rs | 42 +++++++++-- proxmox-auto-installer/src/utils.rs | 15 +++- proxmox-first-boot/Makefile | 11 +++ .../etc/proxmox-first-boot.service | 16 +++++ proxmox-installer-common/src/http.rs | 71 +++++++++++++------ proxmox-installer-common/src/lib.rs | 3 + 15 files changed, 227 insertions(+), 32 deletions(-) create mode 100644 debian/proxmox-first-boot.install create mode 100644 debian/rules.proxmox-first-boot create mode 100644 proxmox-first-boot/Makefile create mode 100644 proxmox-first-boot/etc/proxmox-first-boot.service -- 2.47.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel