git: 6502c60c2281 - main - Move fetch of DEBUG_SH from kenv to rc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 Aug 2024 17:57:22 UTC
The branch main has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=6502c60c22819b879542c423cb7393d448d00e59
commit 6502c60c22819b879542c423cb7393d448d00e59
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2024-08-03 17:56:48 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2024-08-03 17:56:48 +0000
Move fetch of DEBUG_SH from kenv to rc
We only need to check kenv for DEBUG_SH once.
We also need to export DEBUG_SH to be useful.
Sponsored by: Juniper Networks, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D46219
---
libexec/rc/rc | 5 +++++
libexec/rc/rc.subr | 5 +----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libexec/rc/rc b/libexec/rc/rc
index b23b0f35f263..5ed47d6eac20 100644
--- a/libexec/rc/rc
+++ b/libexec/rc/rc
@@ -72,6 +72,11 @@ set -o verify
set +o verify
load_rc_config $rc_config_xtra
+if have DebugOn; then
+ # allow DEBUG_SH to be set from loader prompt
+ export DEBUG_SH=${DEBUG_SH:-$(kenv -q DEBUG_SH)}
+fi
+
# If we receive a SIGALRM, re-source /etc/rc.conf; this allows rc.d
# scripts to perform "boot-time configuration" including enabling and
# disabling rc.d scripts which appear later in the boot order.
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index f1f6cf6c8c2a..145b626aa01e 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -2767,10 +2767,7 @@ $_DEBUG_SH vdot /libexec/debug.sh
# Ensure we can still operate if debug.sh and
# safe_eval.sh are not found.
-if have DebugOn; then
- # allow DEBUG_SH to be set from loader prompt
- DEBUG_SH=${DEBUG_SH:-$(kenv -q DEBUG_SH)}
-else
+if ! have DebugOn; then
DebugOn() { return 0; }
DebugOff() { return 0; }
fi