From nobody Tue Oct 13 23:59:39 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j4BCJ1GCZz6w6My for ; Tue, 13 Oct 2026 23:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j4BCJ0h2cz4q24 for ; Tue, 13 Oct 2026 23:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791935980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0ix7Po3nFZJnccsV32yDRVQOErNIIuNdAhKQZdIrC6M=; b=TWL6wjMUGM6YObNlUM5mDq10ohts4vZc0Wq2FDQkvhW1K3Byl2kpEmdMYJfC70ZVU3VXU1 nmLQoZ1KY6EtEIBby2irGL7pMLbqQdBFVQj4sGFbu4eU5+cqU75VGxZtlkOalHLvupYouy FrwyUXMvZtNi4pRACO4G5/gnXkJr8T8SpfxxHxt+x+U7SRkNrEyGrWCdpytfT8v8B6zy/x BoU/R+csVutzMKNe4dedhpRwv81wLDorMRIewhxNq6OSMgSjvtBz/cNYs+L6lChPS6KF6A OX2E3/zz4avLeHk6/fp+8EJe9NVcglFUL4VeX5xA3+OZdtSlV9Du3VteESd7ZQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791935980; b=uAy6w79nbpFuOqQkxpcHVz2PysD4uhOsCPzLav9QudnqeIb/0N17ftas2rOPTRJJ0T6Llq w1rQa9Wl9sqRz2nal38eo9PtartlzC/MVEMrBlMqiwFwdPdJSayOBYUi5IXsyP6IuFcbAX +kvNXufQ5V7ewa4T2flSYmCDmwRrSBGVsHEf1/1GnzKi7Bm/vYWWEWyOVAtldtHVYOQRAJ /4HjLALsGqg5EOiWbJsT5YvAB+pV/f2esatRixgvdJdX5qL7EmuIYByY1ptIFZC0a+/5zo i4w2k4PFtxYtiwTKM/MbKgbdaL+ItOY453rdbd8QPUj8yobneLM+9Lg9ifamFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791935980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0ix7Po3nFZJnccsV32yDRVQOErNIIuNdAhKQZdIrC6M=; b=EdZPRbL8BJSDnB30CLYa6Xurllu4OqcMZvV0mVrWkD20ZeIko7sg8ySlXBXcE3cQxKEzkD Kn9jTKgwFPTuq2XqMxFP4DSAVwCRwZOWXEmc88927FfFDa+o9z1ir8OnHRI7MHsew3PHeJ ZiQVOLo+XE+dAlnbQ2XbMeQuAZB3pi71325bf3Y+9WagxOEmVxEBRyPHuFKFQBBdF0c0Gy QiUIJwkGEKmUByR0w+oEnnYLcOaPBjmJsqtbEGzYPwFeJDHyuDuRk8CNd3ttt62BKk9tb0 avApW9YhZ/7/aW4KxbhInUPGkFrQtzVUveywpuvxeEoS4ETQPu8GooEKovQ3wQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j4BCH6sSTzf8C for ; Tue, 13 Oct 2026 23:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35d6a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 13 Oct 2026 23:59:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Simon J. Gerraty Subject: git: 34e92fb6bd8d - main - hooks.sh allow running DebugO{n,ff} from hooks_run List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b Auto-Submitted: auto-generated Date: Tue, 13 Oct 2026 23:59:39 +0000 Message-Id: <6acec5eb.35d6a.701893f4@gitrepo.freebsd.org> The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b commit 34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b Author: Simon J. Gerraty AuthorDate: 2026-10-13 23:59:32 +0000 Commit: Simon J. Gerraty CommitDate: 2026-10-13 23:59:32 +0000 hooks.sh allow running DebugO{n,ff} from hooks_run We need to watch out for _debugO{n,ff}_hooks. Also add add_list (hook lists are just lists). Fix bug in hooks_has() - should look for $2 in list. --- libexec/rc/hooks.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/libexec/rc/hooks.sh b/libexec/rc/hooks.sh index 0c577d831101..7c2aa62f80a0 100755 --- a/libexec/rc/hooks.sh +++ b/libexec/rc/hooks.sh @@ -16,6 +16,9 @@ # run_hooks HOOKS [LIFO] ["args"] # run_hooks_all HOOKS [LIFO] ["args"] # +# add_list LIST [options] item [...] +# add_list_once LIST [options] item [...] +# # DESCRIPTION: # The functions add_hooks and run_hooks are retained for # backwards compatibility. They are aliases for hooks_add and @@ -46,11 +49,14 @@ # calls to hooks_add. # Any "args" specified are passed to each hook function. # +# add_list is just another alias for hooks_add, same for +# add_list_once. +# # RCSid: -# $Id: hooks.sh,v 1.26 2025/08/07 21:59:54 sjg Exp $ +# $Id: hooks.sh,v 1.31 2026/10/13 23:52:51 sjg Exp $ # -# @(#)Copyright (c) 2000-2024 Simon J. Gerraty +# @(#)Copyright (c) 2000-2026 Simon J. Gerraty # # SPDX-License-Identifier: BSD-2-Clause # @@ -74,6 +80,11 @@ fi # for backwards compatibility local=$_local +if test -z "$_DEBUG_SH"; then + DEBUG_DO=: + DebugOn() { return 0; } + DebugOff() { return 0; } +fi ## # hooks_add_all list func ... @@ -179,7 +190,7 @@ hooks_has() { eval $_local __h eval "__h=\$$1" case " $__h " in - *" $1 "*) return 0;; + *" $2 "*) return 0;; esac return 1 } @@ -197,6 +208,7 @@ hooks_run() { while : do + : "1=$1" case "$1" in --all) __a=:; shift;; --lifo) __l=$1; shift;; @@ -204,14 +216,23 @@ hooks_run() { esac done __hl=$1; shift + case "$__hl" in + *_debugOn_hooks|*_debugOff_hooks) ;; + *) DebugOn hooks_run hooks_run:$__hl;; + esac case "$1" in LIFO) __l=--lifo; shift;; esac __h=`hooks_get $__l $__hl` for e in $__h do + $DEBUG_DO echo hooks_run:$__hl:$e >&2 $e "$@" || $__a $? done + case "$__hl" in + *_debugOn_hooks|*_debugOff_hooks) ;; + *) DebugOff hooks_run hooks_run:$__hl;; + esac } ## @@ -238,6 +259,14 @@ run_hooks_all() { hooks_run --all "$@" } +# hook lists are just lists +add_list() { + hooks_add "$@" +} + +add_list_once() { + hooks_add_once "$@" +} case /$0 in */hooks.sh)