Page MenuHomeFreeBSD

D43822.id134107.diff
No OneTemporary

D43822.id134107.diff

diff --git a/sbin/reboot/reboot.8 b/sbin/reboot/reboot.8
--- a/sbin/reboot/reboot.8
+++ b/sbin/reboot/reboot.8
@@ -36,16 +36,16 @@
.Nd stopping and restarting the system
.Sh SYNOPSIS
.Nm halt
-.Op Fl flNnpq
+.Op Fl DflNnpq
.Op Fl k Ar kernel
.Nm
-.Op Fl cdflNnpqr
+.Op Fl cDdflNnpqr
.Op Fl k Ar kernel
.Nm fasthalt
-.Op Fl flNnpq
+.Op Fl DflNnpq
.Op Fl k Ar kernel
.Nm fastboot
-.Op Fl dflNnpq
+.Op Fl dDflNnpq
.Op Fl k Ar kernel
.Sh DESCRIPTION
The
@@ -77,6 +77,10 @@
with a BMC that supports power cycling.
Unlike power off, the amount of hardware that supports power cycling
is small.
+.It Fl D
+Delete existing
+.Nm nextboot
+configuration and exit.
.It Fl d
The system is requested to create a crash dump.
This option is
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -96,7 +96,7 @@
struct utmpx utx;
const struct passwd *pw;
int ch, howto, i, sverrno;
- bool fflag, lflag, nflag, qflag, Nflag;
+ bool Dflag, fflag, lflag, Nflag, nflag, qflag;
uint64_t pageins;
const char *user, *kernel = NULL;
@@ -105,12 +105,15 @@
howto = RB_HALT;
} else
howto = 0;
- fflag = lflag = nflag = qflag = Nflag = false;
+ Dflag = fflag = lflag = Nflag = nflag = qflag = false;
while ((ch = getopt(argc, argv, "cdk:lNnpqr")) != -1)
switch(ch) {
case 'c':
howto |= RB_POWERCYCLE;
break;
+ case 'D':
+ Dflag = true;
+ break;
case 'd':
howto |= RB_DUMP;
break;
@@ -149,6 +152,8 @@
if (argc != 0)
usage();
+ if (Dflag && ((howto & ~RB_HALT) != 0 || kernel != NULL))
+ errx(1, "cannot delete existing nextboot config and do anything else");
if ((howto & (RB_DUMP | RB_HALT)) == (RB_DUMP | RB_HALT))
errx(1, "cannot dump (-d) when halting; must reboot instead");
if (Nflag && (howto & RB_NOSYNC) != 0)
@@ -164,6 +169,12 @@
err(1, NULL);
}
+ if (Dflag) {
+ if (unlink(PATH_NEXTBOOT) != 0)
+ err(1, "unlink %s", PATH_NEXTBOOT);
+ exit(0);
+ }
+
if (qflag) {
reboot(howto);
err(1, NULL);

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 12, 6:35 PM (7 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23635870
Default Alt Text
D43822.id134107.diff (1 KB)

Event Timeline