Date: Mon, 12 Feb 2024 18:53:44 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 9dcf6cbd83fd - main - reboot: Implement -k in terms of env Message-ID: <202402121853.41CIrixK030694@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 commit 9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-02-12 18:45:54 +0000 Commit: Warner Losh <imp@FreeBSD.org> 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402121853.41CIrixK030694>