Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131859721
D43822.id134107.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43822.id134107.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D43822: reboot: Implement -D from nextboot
Attached
Detach File
Event Timeline
Log In to Comment