From nobody Sat Jun 6 06:14:20 2026 X-Original-To: dev-commits-src-main@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 4gXSgd0PZmz6g4pK for ; Sat, 06 Jun 2026 06:14:21 +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 4gXSgc3LSBz3T8g for ; Sat, 06 Jun 2026 06:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780726460; 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=FtDN7KT+3J+N2ydBia6LLb173UtaJuYgiAaqcoKUHC8=; b=eqneLemCzmDR4PJR8fwww7kShCvWnutq1ayFX1n+DeBv6QadPJmpF0A0wGyBlbwA8OfDlp JIVg/3t/WTyT94uQyQ1WRAIeCxX1wWUg0RqiET2ex0peDV2pt9ASIDnlzLjxVNPvQXodWj Oxa0WEKhDUr2r6OImDxZ3h/BdWqXcHu6jIfAnmFYjKFlDz8GBgcT0bRDBCz9IM8avpJwvu OG0SEVzxDJNI5nw6K8RpjHsxnsT9h1TREUUq5KRhOXTLAQQLTn9N1sQEct3DMgRBrbR6vj 2MZvmmERfha3SGrasM7V0q+Yfb7eCWgDDZubytbRBvhUqjyjDaghTcVeywPaTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780726460; a=rsa-sha256; cv=none; b=JgYdOXHfelWvfTMD0wRPvU9UAAEkv3r/7EQAJl/T+m5zU6FzLAIsUxxkcT4oLObUdaCPMK huWKdRarbo98dd7GqcB/VachRSJ6P+AouIu2nwTWepM/YYWmFubTROXaZPLZS1IU5sGVNd 0OChtXv54KKb8A4ddmFQaiq9WqEVrFERls4HavSUAR5MKM+WPg3Vic2PEyKNgh8XgMWzhl i3kvJ79Mp9OoGdW8OyKIBsryBpGc1Pu6+G48RXBAzfgdHhA7xwYwuH7EYFX1MuFGBh3ETg jOTFxP4mdsapWIUxH1YbeI+ifQefRdyzfxeMNzVdh1D1A180mtxeFeSgnsZchw== 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=1780726460; 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=FtDN7KT+3J+N2ydBia6LLb173UtaJuYgiAaqcoKUHC8=; b=sPhPUp/QlJ3U3fda8Aj/PzoPrLqtjKKL6Ss8pY2xIcUyQyTCHGW3R/OPVKCJIDPvBElK0e QUPGI0qlHlSIoCdYTKxooXRqHHZzYFWzuxQ4BO8wasgcfWTtJNfjDsAd/JBu+8kyMALw5+ v9XJkxxogElmz/FNDx5AhwLJNdI/7q95IvfrgKt9kZoM9O5PFVf2jCL9k6fU9DxTw8yoQl 8rtDlqZQdDIuFX7nL4puRVvqg0gYWwm8TMCMJH97nD4R4gmZ/D7EXpwZwM05lMIxkbJwss GAYTGi0cGxh9hs9FM1K75fkByWyLYJ+4EorHfSvwERGEhPkpflKOkIXWKd1ipg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gXSgc2Qnpz13jQ for ; Sat, 06 Jun 2026 06:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2796c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 06 Jun 2026 06:14:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: e01f202ecf93 - main - nuageinit: implement final_message support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: e01f202ecf9344bd6658869a869f36c5b3790384 Auto-Submitted: auto-generated Date: Sat, 06 Jun 2026 06:14:20 +0000 Message-Id: <6a23babc.2796c.7af9ed0@gitrepo.freebsd.org> The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=e01f202ecf9344bd6658869a869f36c5b3790384 commit e01f202ecf9344bd6658869a869f36c5b3790384 Author: Baptiste Daroussin AuthorDate: 2026-06-05 21:03:45 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-05 21:03:45 +0000 nuageinit: implement final_message support --- libexec/nuageinit/nuageinit | 25 +++++++++++++++++++++++++ libexec/nuageinit/tests/nuageinit.sh | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 8a9c5c022862..1391aff13bd6 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -784,6 +784,30 @@ local function power_state_change(obj) os.execute(cmd) end +local function get_uptime() + -- Get system uptime in seconds + local f = io.popen("sysctl -n kern.boottime 2>/dev/null") + local boottime = f:read("*a") + f:close() + local sec = boottime:match("sec = (%d+)") + if sec then + return os.time() - tonumber(sec) + end + return 0 +end + +local function final_message(obj) + if obj.final_message == nil then return end + local msg = obj.final_message + if type(msg) ~= "string" then + nuage.warn("final_message must be a string") + return + end + local uptime = tostring(math.floor(get_uptime())) + msg = msg:gsub("%$UPTIME", uptime) + nuage.warn(msg, false) +end + local function chpasswd(obj) if obj.chpasswd == nil then return end nuage.chpasswd(obj.chpasswd) @@ -1090,6 +1114,7 @@ elseif line == "#cloud-config" then users, chpasswd, write_files_deferred, + final_message, power_state_change, } diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh index c3c75949da65..2b4d316fd5ff 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -46,6 +46,7 @@ atf_test_case config2_userdata_locale atf_test_case config2_userdata_fqdn_and_hostname atf_test_case config2_userdata_write_files atf_test_case config2_userdata_encode_base64 +atf_test_case config2_userdata_final_message setup_test_adduser() { @@ -1401,6 +1402,20 @@ config2_userdata_encode_base64_body() /usr/libexec/flua -e "print(require('nuage').encode_base64(''))" } +config2_userdata_final_message_body() +{ + mkdir -p media/nuageinit + setup_test_adduser + export NUAGE_RUN_TESTS=1 + printf "{}" > media/nuageinit/meta_data.json + cat > media/nuageinit/user_data << 'EOF' +#cloud-config +final_message: "System ready after $UPTIME seconds" +EOF + atf_check -e match:"System ready after [0-9]+ seconds" \ + /usr/libexec/nuageinit "${PWD}"/media/nuageinit postnet +} + atf_init_test_cases() { atf_add_test_case args @@ -1442,4 +1457,5 @@ atf_init_test_cases() atf_add_test_case config2_userdata_fqdn_and_hostname atf_add_test_case config2_userdata_write_files atf_add_test_case config2_userdata_encode_base64 + atf_add_test_case config2_userdata_final_message }