git: 72b045386dd3 - main - rc: Set var_run_enable to enable by default

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 28 Feb 2024 07:18:20 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=72b045386dd3db8b31ec3067cb9e160cbd1cfbc6

commit 72b045386dd3db8b31ec3067cb9e160cbd1cfbc6
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-02-27 17:33:52 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-02-28 07:17:58 +0000

    rc: Set var_run_enable to enable by default
    
    This will load/save the /var/run directories at boot/shutdown if
    and only if /var/run/ is a tmpfs mount so it is a win for tmpfs
    users and a no-op for everyone else.
    
    Reviewed by:    bapt
    Differential Revision:  https://reviews.freebsd.org/D44097
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 libexec/rc/rc.conf      | 4 ++--
 libexec/rc/rc.d/var_run | 5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 20f0a6375a9e..2fa3b676cb38 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -61,8 +61,8 @@ varmfs_flags="-S"	# Extra mount options for the mfs /var
 mfs_type="auto"		# "md", "tmpfs", "auto" to prefer tmpfs with md as fallback
 populate_var="AUTO"	# Set to YES to always (re)populate /var, NO to never
 cleanvar_enable="YES" 	# Clean the /var directory
-var_run_enable="NO" 	# Save/restore /var/run structure at shutdown/reboot
-var_run_autosave="NO" 	# Only restore /var/run structure at shutdown/reboot
+var_run_enable="YES" 	# Save/restore /var/run structure at shutdown/reboot
+var_run_autosave="YES" 	# Only restore /var/run structure at shutdown/reboot
 			# The user is expected to issue service var_run save to
 			# manually save the /var/run mtree
 var_run_mtree="/var/db/mtree/BSD.var-run.mtree"
diff --git a/libexec/rc/rc.d/var_run b/libexec/rc/rc.d/var_run
index daff06ce1a3f..bf8f0cb737b4 100755
--- a/libexec/rc/rc.d/var_run
+++ b/libexec/rc/rc.d/var_run
@@ -17,11 +17,6 @@ stop_cmd="_var_run_stop"
 
 load_rc_config $name
 
-# Set defaults
-: ${var_run_enable:="NO"}
-: ${var_run_mtree:="/var/db/mtree/BSD.var-run.mtree"}
-: ${var_run_autosave:="YES"}
-
 _var_run_load() {
 	test -f ${var_run_mtree} &&
 		mtree -U -i -q -f ${var_run_mtree} -p /var/run > /dev/null