From nobody Fri Jun 5 06:40:29 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gWsJM0cPyz6gXQS for ; Fri, 05 Jun 2026 06:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gWsJL3WQ1z3RZf for ; Fri, 05 Jun 2026 06:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780641634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vjbMEGWcfHAk2w2lealZ7G1+ty03ShlhG5HXcywwNQQ=; b=eL2aqDdtRktEPZDQY6sfyB+m7mo2Nqr3A4yvT5+UQGHDFAv8icYoAiuA/NxCTiSFhqYzAk QmOyiHsUQavFUmvr8LpGfF5En8qpa9sddbnuik9hXkkPI2wHAHn7F8tBn3ECjasNPMkd8z Zj7vFwbTlzq1eWCxNYFlGrjDqn4u5QcoYBF/BF5F6oDKG1RXh40OaM6TMSDYvIrQIZ7CFJ +Fn9q+1vRTa3s0JBKeFqBi6m1sfbTvXMtcjS2ebCaJmQazQcZ5tjlwB/buVTJTvfqCyd3H j4FbOREp1tPFtifCY0b9bQFaLpRLFvZZnxFYc10ZQ6mNXARvXk1RagPrfMA+rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780641634; a=rsa-sha256; cv=none; b=bMtELjRnvnZsb74MtN94gIBvPfRQXokSMwB+OUIHlAQAnB4+CK9PZXdGB9IImW5K/lYYKY OzDsB0arBAHKqLnvgtqevaXE60Mi+5dLMfpCnfmihMB4+B9wvm8wHXwb/SPK7K7VElBc3m /e499SJ6uu9mG6lnh0pJYLp10t6kwcsQAithHj4NVOC5IYcOqqCtMzg6D8XpXQWT/sq9M8 fTB5jgP29ICh1XoXD1kTIs1OT49JxIcslnFkbW/Cxt+lKcxM7XsZB8JoD80THlA44oiRu8 rUBVdYhskdB/Kgd2cAoKpG1rNDClmGvYMxL2/fEcSRUv0Gv9pLclmArH0E4wog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780641634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vjbMEGWcfHAk2w2lealZ7G1+ty03ShlhG5HXcywwNQQ=; b=aDIk9TqrEDYtMRVudrlUTGti+1fWHhv7TVXJQ+MpYKh3Vku4Lc+m+UrSSQc9xdCNP1tMaD S8uw7KqEuLlI6uVSoJdELkDpPk3nFAUl/DZ+4AdNTSUcwR+wq2TqMG3ThUoTqIKwlRdjTE MWA9jS/nLRSbwKR7ZQpVlEivW3eexBQDQOQQS/yd9TbScRyYz28Avo4KEZFyGvaq+j+kqe AINcIxC429HL13VxqxqWGuiCG3f3iDx/hfZumSxgxb+v9t+ew+CHTpRrB3Pqf5iaehhCK4 UdGB4wPQ2EZmkrjIZwSFB3l7MteG4Wyz3sM/QQFgJUM8BIgOe5eIQ4fudYjZpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gWsJL36L0z37k for ; Fri, 05 Jun 2026 06:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31644 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 05 Jun 2026 06:40:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: b9be7608cd13 - main - nuageinit: implement bootcmd support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9be7608cd13888a32815bfb2263e20855706969 Auto-Submitted: auto-generated Date: Fri, 05 Jun 2026 06:40:29 +0000 Message-Id: <6a226f5d.31644.28ff30f5@gitrepo.freebsd.org> The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b9be7608cd13888a32815bfb2263e20855706969 commit b9be7608cd13888a32815bfb2263e20855706969 Author: Baptiste Daroussin AuthorDate: 2026-06-05 05:00:00 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-05 05:00:00 +0000 nuageinit: implement bootcmd support Add support for the 'bootcmd' cloud-config directive, which allows running commands very early in the boot process, before the hostname is set and before the network is configured. - nuageinit: bootcmd() function follows the same pattern as runcmd(), writing commands to /var/cache/nuageinit/bootcmds instead of runcmds. It is the first entry in the pre_network_calls table. - rc.d/nuageinit: execute /var/cache/nuageinit/bootcmds immediately after /usr/libexec/nuageinit completes, before unmounting the config drive. This ensures bootcmd runs before NETWORKING per cloud-init spec. --- libexec/nuageinit/nuageinit | 18 ++++++++++++++++++ libexec/nuageinit/nuageinit.7 | 5 +++++ libexec/rc/rc.d/nuageinit | 4 ++++ 3 files changed, 27 insertions(+) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 166c3503735a..bfe5f893756e 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -524,6 +524,23 @@ local function disable_root(obj) end end +local function bootcmd(obj) + if obj.bootcmd == nil then return end + local f = nil + for _, c in ipairs(obj.bootcmd) do + if f == nil then + nuage.mkdir_p(root .. "/var/cache/nuageinit") + f = assert(io.open(root .. "/var/cache/nuageinit/bootcmds", "w")) + f:write("#!/bin/sh\n") + end + f:write(c .. "\n") + end + if f ~= nil then + f:close() + nuage.chmod(root .. "/var/cache/nuageinit/bootcmds", "0755") + end +end + local function runcmd(obj) if obj.runcmd == nil then return end local f = nil @@ -794,6 +811,7 @@ if line == nil then -- YAML user-data elseif line == "#cloud-config" then local pre_network_calls = { + bootcmd, sethostname, settimezone, groups, diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index 08a64b11ff58..3cc0eceeb2ae 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -362,6 +362,9 @@ does not automatically install them. Ensure the relevant command is listed in your .Nm packages section. +.It Ic bootcmd +An array of commands to be run early in the boot process, +before the hostname is set and before the network is configured. .It Ic chpasswd Change the passwords for users, it accepts the following keys: .Bl -tag -width "expire" @@ -424,6 +427,8 @@ Here is an example of a YAML configuration for .Nm : .Bd -literal #cloud-config +bootcmd: + - kldload if_bridge fqdn: myhost.mynetwork.tld users: - default diff --git a/libexec/rc/rc.d/nuageinit b/libexec/rc/rc.d/nuageinit index 259ce3c138e5..e2f0a85bc3bc 100755 --- a/libexec/rc/rc.d/nuageinit +++ b/libexec/rc/rc.d/nuageinit @@ -89,6 +89,10 @@ nuageinit_start() /usr/libexec/nuageinit /media/nuageinit $citype 2>&1 | tee -a /var/log/nuageinit.log ;; esac + if [ -x /var/cache/nuageinit/bootcmds ]; then + echo "Executing 'bootcmd'" | tee -a /var/log/nuageinit.log + /var/cache/nuageinit/bootcmds 2>&1 | tee -a /var/log/nuageinit.log + fi if [ -n "$drive" ]; then umount /media/nuageinit rmdir /media/nuageinit