From nobody Fri Jun 16 14:45:18 2023 X-Original-To: dev-commits-src-all@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 4QjMQQ3HHGz4fKmh; Fri, 16 Jun 2023 14:45:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QjMQQ2qpbz45PG; Fri, 16 Jun 2023 14:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686926718; 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=6qmuu4Bkhjc+XZg0t+8yPAaG7FUFOKlgnrBNfUZG1/U=; b=SrdZz+YNxnClYy9sFgw8QMKe3QV+5U11Efgr8qw23rg9psvCIDvF7Izcm7iipC1zkzSnWH OjFzFBIijXCMJHL55pzjgt6DgPR90st3hwiRw2LHiItYv1o3BUDhFAn/7dLf6cuyQyIofZ nDUUEnRJreQB724O6U7nV7rq+5L3h6b41Ns1KS0oI0w1Kp/3DhVdxDpB5+EpQm4W1JQEOX /bJ3MYp4aagSydPpMf+hq7DFNKpOvGT0ddkws8Q1mokOciKPI+h3Bk1roHLRYb+w7uAv/r B/D1CUKvcI8258Lv6iiQ0ZI1ELBjxwUXvaHgeQX154acaOlF6RpQcARDQVltGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686926718; 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=6qmuu4Bkhjc+XZg0t+8yPAaG7FUFOKlgnrBNfUZG1/U=; b=uc7yMV5KOrSmLggCy9gRzQRT4OMQh02TyuwIRCFo7xORaB0QsFloxD1z+EeeYI2h0ueWms VVEVUY+/6jeYTI5zk7q0vYfv1+st2RJlp3imLoyJPVmt171bBL0mhGTNHP3KUE87zwvThi KsknoVZcetEBVpcwS69qglX2O8AVNiuZQfAflsPatG4IkXNRU8D3GuIIhuMRxDOXwrDKJF bY3HKxKCi1gMxlSF2gmMBJhPEqdjEfSCEp9tkju+wHu+lxY1A3DYftywuCzde9nrrLjUjt HZlWl9P6YtC3UEF8bKLF9kRth75+w+LMTkfuvo7ZH4cJLKfwuQuMYD/67BoC/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686926718; a=rsa-sha256; cv=none; b=EOMI1o46rfPhyFQuIPljYRHQPSISYamHjsBhsH9JHrYSSNzU0/NTSBTuMvHacevpWp6bKP jMTHU7dRHmdNGOGQvX8FRzAInQFEDybsPDb3MQQCdMcTkl+15XW9H0xlHINsf/m9M+ltIA p/r0rK5Js5zfDliS9x3CgMtiq6xgOlKv3avv6dsAI5k4q7Vd4cjmPqaLcqjpnprf10JOKF YuokABC00wS8cperNy8h6oKmkz4Joys+0qq9HMuqRE5cBBQWtDKMSXMhfIW6azQPHcogix RKThHrxgRZ4kLyPjDaJ46NWlVj6BM9W717mztdzte5XFlDIfMQatf4Rv0tp1Iw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QjMQQ1vLkzX9X; Fri, 16 Jun 2023 14:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35GEjIkJ074854; Fri, 16 Jun 2023 14:45:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35GEjIBi074853; Fri, 16 Jun 2023 14:45:18 GMT (envelope-from git) Date: Fri, 16 Jun 2023 14:45:18 GMT Message-Id: <202306161445.35GEjIBi074853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Juraj Lutter Subject: git: e5d7100c09e0 - main - periodic: Honor kern.localbase List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5d7100c09e03e66535eee69d7e454c01e4a9d28 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by otis: URL: https://cgit.FreeBSD.org/src/commit/?id=e5d7100c09e03e66535eee69d7e454c01e4a9d28 commit e5d7100c09e03e66535eee69d7e454c01e4a9d28 Author: Juraj Lutter AuthorDate: 2023-06-06 11:40:49 +0000 Commit: Juraj Lutter CommitDate: 2023-06-16 14:39:04 +0000 periodic: Honor kern.localbase Take kern.localbase into account with fallback to /usr/local and also allow for LOCALBASE/etc/periodic.conf (similarly to what many other utilities do). Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40435 MFC after: 2 weeks --- usr.sbin/periodic/periodic.8 | 9 +++++++-- usr.sbin/periodic/periodic.conf | 6 +++--- usr.sbin/periodic/periodic.sh | 6 +++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.sbin/periodic/periodic.8 b/usr.sbin/periodic/periodic.8 index 2fda1db157f5..fd09fbf1b368 100644 --- a/usr.sbin/periodic/periodic.8 +++ b/usr.sbin/periodic/periodic.8 @@ -183,7 +183,7 @@ and the standard and .Pa security scripts -.It Pa /etc/periodic.conf +.It Pa /etc/periodic.conf , ${LOCALBASE}/etc/periodic.conf this file contains local overrides for the default .Nm configuration @@ -207,7 +207,12 @@ system registry will typically have a .Va local_periodic variable reading: .Pp -.Dl local_periodic="/usr/local/etc/periodic" +.Dl local_periodic="${_localbase}/etc/periodic" +.Pp +where +.Pa ${_localbase} +is being set from within +.Pa /usr/sbin/periodic . .Pp To log .Nm diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf index 61cebe858372..c22ff6fe652d 100644 --- a/usr.sbin/periodic/periodic.conf +++ b/usr.sbin/periodic/periodic.conf @@ -17,10 +17,10 @@ # # What files override these defaults ? -periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local" +periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local ${_localbase}/etc/periodic.conf" -# periodic script dirs -local_periodic="/usr/local/etc/periodic" +# periodic script dirs. _localbase is being set in /usr/sbin/periodic +local_periodic="${_localbase}/etc/periodic" # Max time to sleep to avoid causing congestion on download servers anticongestion_sleeptime=3600 diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh index cdbd1b3b57fb..bec13bc4fe89 100644 --- a/usr.sbin/periodic/periodic.sh +++ b/usr.sbin/periodic/periodic.sh @@ -30,9 +30,13 @@ if [ $# -lt 1 ] ; then usage fi +_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null` +# Set default value of _localbase if not previously set +: ${_localbase:="/usr/local"} + # Use a deterministic path to match the preset from /etc/crontab in case # periodic is run interactively. -export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin # If possible, check the global system configuration file, # to see if there are additional dirs to check