From nobody Mon Feb 12 18:53:44 2024 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 4TYYWr3k1lz5BMcf; Mon, 12 Feb 2024 18:53:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TYYWr2nNKz4mMD; Mon, 12 Feb 2024 18:53:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707764024; 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=o3Hu14qSKKdc4wTuWbtigmcOLpdu1HtYF7fLO0sUPQw=; b=UdO58/PiPV83WXSzVCiaMyWNrkbuZhBukpKwbvbjNbUxgL6F/i8kfDlcjzSJ8k+Z0OuIc5 ii2yNlh+TtIA5yHaPdxtG6P2BQWOgkb73aT3bqVbjFH3wa74vYyiWaZ7uvNumulSoEylj/ WBN2eQ7hCbtLLMSK8rnRDf0TNrJ5kjjM+Bv+TDxarhs8U4TAE/vkadj7nKT4sIZjeAWgIU Ea/G9e8TJLnT4OEL1hZqGjn3GZN8S8+lgPB891OA52sig0qauYhSoe75NzA6T8Dm5HYRA7 bxSv2DTYyano/SsFlMERIdUBTKc5SpGgp6onY0YUo96XQ8Hegv1cdhDBkz9/Hg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707764024; a=rsa-sha256; cv=none; b=Qrdzv5XUEentADaDj6jcc5IvpvgiFlZx2xuIU3mRzc6v7940GHDYgWEliZA0ixwaFBeJrC 8NEcnsxlDmT1mJmcW1RH7/wnHC31rpuJ8U72SfKb3eDsrTBr7vKw7zVA8ImsqsxoKh1/s/ BIFbtdpz6AQgp0wshXpj2udWruevU49htMSvEY7aKTNUb9fLOzWr4UzF1Z6TPHgPguq9xO Q4u1tDPDmwmZuvX3DBqbt8rK3s4wsK9hpO0SL9EaSDCnjduE6vSuHVwTq2dGf3aBLjiX6D uxe/H43yQKR/ysfbFp22/uXxU9ucUV6dDpyt5IRC8/bprT8WIJYzAv52PvOhDg== 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=1707764024; 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=o3Hu14qSKKdc4wTuWbtigmcOLpdu1HtYF7fLO0sUPQw=; b=WMKWniUnH0SzcotgbPme5Z9Opy57L09/TpSUNBKxQQD7Dn2pRXO5aQLEO6wnTSHLouGdoQ rdKp/a6bRHrYQA3Kpu6/lWXHJvRC9NHkWkfkYZyRgvsF/enDusEySP8aR/M65SVRqxm8QS njPwddRoYp1kTvMdT62XXSLx9b6BHPE9/Cx8e/ta1br96pJR1IpT54lTjdovQIOYgotX0K qanZiq6ufNwPnwFudwg0YyZ3AvkFGTJDDTB2EFJW40Fk6HcYHSKxJgbZUXUhdVGGP1poQB K+K6A76PZR8ia2TS/F9pNfRjh9NMsYqVAJFE7/e2d8KltMBlb8ya+EemfMY8rQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TYYWr1tXMzjKF; Mon, 12 Feb 2024 18:53:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41CIri4h030697; Mon, 12 Feb 2024 18:53:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41CIrixK030694; Mon, 12 Feb 2024 18:53:44 GMT (envelope-from git) Date: Mon, 12 Feb 2024 18:53:44 GMT Message-Id: <202402121853.41CIrixK030694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9dcf6cbd83fd - main - reboot: Implement -k in terms of env 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 commit 9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 Author: Warner Losh AuthorDate: 2024-02-12 18:45:54 +0000 Commit: Warner Losh CommitDate: 2024-02-12 18:45:54 +0000 reboot: Implement -k in terms of env kernel isn't special, beyond the sanity checks we do. Add it to the env rather than pass it into write_nextboot(). Sponsored by: Netflix Reviewed by: kevans, kib Differential Revision: https://reviews.freebsd.org/D43828 --- sbin/reboot/reboot.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 875f00c01ef9..a4be86a4983f 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -88,7 +88,7 @@ zfsbootcfg(const char *pool, bool force) } static void -write_nextboot(const char *fn, const char *env, const char *kernel, bool force) +write_nextboot(const char *fn, const char *env, bool force) { FILE *fp; struct statfs sfs; @@ -112,12 +112,11 @@ write_nextboot(const char *fn, const char *env, const char *kernel, bool force) fp = fopen(fn, "w"); if (fp == NULL) - E("Can't create %s to boot %s", fn, kernel); + E("Can't create %s", fn); - if (fprintf(fp,"%s%skernel=\"%s\"\n", + if (fprintf(fp,"%s%s", supported ? "nextboot_enable=\"YES\"\n" : "", - env != NULL ? env : "", - kernel) < 0) { + env != NULL ? env : "") < 0) { int e; e = errno; @@ -175,7 +174,6 @@ main(int argc, char *argv[]) const char *user, *kernel = NULL; char *env = NULL, *v; - if (strstr(getprogname(), "halt") != NULL) { dohalt = true; howto = RB_HALT; @@ -274,9 +272,10 @@ main(int argc, char *argv[]) errx(1, "%s is not a file", k); free(k); } - write_nextboot(PATH_NEXTBOOT, env, kernel, fflag); + add_env(&env, "kernel", kernel); } + write_nextboot(PATH_NEXTBOOT, env, fflag); /* Log the reboot. */ if (!lflag) { if ((user = getlogin()) == NULL)