Date: Sat, 10 May 2025 19:33:17 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8cb3670fb90e - stable/14 - rc.d: Add precious_machine rc.conf knob to create /var/run/noshutdown Message-ID: <202505101933.54AJXHRd055228@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8cb3670fb90ebe14ea609cd576f5dc235814f8b1 commit 8cb3670fb90ebe14ea609cd576f5dc235814f8b1 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-05-04 13:51:26 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-05-10 18:57:46 +0000 rc.d: Add precious_machine rc.conf knob to create /var/run/noshutdown (cherry picked from commit 384d976725a5c29734a9227fcdb6ef0807485c91) --- libexec/rc/rc.conf | 2 ++ libexec/rc/rc.d/Makefile | 1 + libexec/rc/rc.d/noshutdown | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 3f8b0ae7b42f..b3c54c3cb0f0 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -29,6 +29,8 @@ rc_info="NO" # Enables display of informational messages at boot. rc_startmsgs="YES" # Show "Starting foo:" messages at boot rcshutdown_timeout="90" # Seconds to wait before terminating rc.shutdown +precious_machine="NO" # Set to YES to get some guards against mis-directed + # shutdown(8) commands early_late_divider="FILESYSTEMS" # Script that separates early/late # stages of the boot process. Make sure you know # the ramifications if you change this. diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 320408d5d62c..e218ecf516d1 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -67,6 +67,7 @@ CONFS= DAEMON \ nfsd \ nfsuserd \ nisdomain \ + noshutdown \ ${_nscd} \ ntpdate \ ${_opensm} \ diff --git a/libexec/rc/rc.d/noshutdown b/libexec/rc/rc.d/noshutdown new file mode 100755 index 000000000000..54924310a6c7 --- /dev/null +++ b/libexec/rc/rc.d/noshutdown @@ -0,0 +1,31 @@ +#!/bin/sh +# +# + +# PROVIDE: noshutdown +# REQUIRE: var +# BEFORE: LOGIN + +. /etc/rc.subr + +name="noshutdown" +desc="Disable shutdown(8) for precious machines" +rcvar="precious_machine" +start_cmd="noshutdown_start" +stop_cmd="noshutdown_stop" + +: ${noshutdown_file:="/var/run/noshutdown"} + +noshutdown_start() +{ + touch $noshutdown_file +} + +noshutdown_stop() +{ + rm -f $noshutdown_file +} + +load_rc_config $name + +run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505101933.54AJXHRd055228>