From nobody Thu Jul 6 07:57:44 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 4QxTQw2hNyz4mCP4; Thu, 6 Jul 2023 07:57:44 +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 4QxTQw22wcz3DJ1; Thu, 6 Jul 2023 07:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688630264; 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=ldOwpTqRvwJ4kssViTOUFm7rWO6GcsIxxF99GvwonY0=; b=UVFMXVxmZu0kvAvaPhHzYf6WMTJKrGIsiTymXzHA6P4TcXVDTEd8Yd8NecgB3Lbep5Fz63 UQJuEkAPoGN1VG9WkF95a02mtt+JUVhevMUh9OEicUzo0YivIik/Mxta3zh/2eapUVgNa9 sgcCW0wDbeW9CefX7QmZZCFJ1FUCCJhxXRNcPNKntXsmAhw+33RJIYB33H4696H794JoLv oLhO5/0JPlaEsXv05dRuMOCZATj0OwlhKYjeONE5zOvUhVeanGpCE7HIpNAnP3lIdEuoSF vCZ7GmJ78TF9Q+hq/XRN9Jo3dFUOlax8CeK2f0AwhbKibvwdV7j3IyRS+7OcJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688630264; 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=ldOwpTqRvwJ4kssViTOUFm7rWO6GcsIxxF99GvwonY0=; b=k5FQGi0KBuS9u0MptZt6L23sQ4OblAwxKJfMSq1SF1qPx+iIsSF3JjDiW3E532kqvSY/Nk /KuyE7HZaAIvofVr+iRIZ2g691q23uFpzxuTi/FCJc0bTi/hn8sc54xR5uR3aPoADkkwMp keXR77jOXGDvQwMHm3E9lmS6gyC9oDG+RfJxPRJKdh76sJ7i/XvOcNQsaZb4Q+TT7kJlrg YCiRbmnVk3BUGjarmHKOzRputB3s5kf1JZykjnjsDyIhK1kc0BHSJ+f8cdkf8iZC2td9ZC QyYjo/pUmJcqW/JwUdqegMb5L8cDKjzxUXhEdERGlCSnYN2i8zXpf7S/EXYHBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688630264; a=rsa-sha256; cv=none; b=cY97aU3BYr2rdaHly240tL5PMlyP4vr7vKQtBYF8YC61GkbetUYTc3DlmlkZCa7Q5pJmlV 82PJe26wHRpvTxKlHdHs5TVnbxGH1AZCUBAYAqWqabdMAH6x4Kpald/i2TZ0cpGP4t+jEZ megyBKudBTaCtEiW6IL2Bm+4PfoVbB4ZIZhVv/ACB/wnEUidViKAP5GwowG75qu0pfcRGN IVRzUz2h1mfirGJle27Dk75x5lpVOT3W1787+Ttlmkcht0LkWrAtPdTC7BpNZTQ6LvmbOW TifwyX2inLolRhNiR522FcyU+k1pBqdTJl3fLmxblgZhyzWwgJzb6V5KutRTaw== 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 4QxTQw10NYznl3; Thu, 6 Jul 2023 07:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3667viRj038256; Thu, 6 Jul 2023 07:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3667viac038253; Thu, 6 Jul 2023 07:57:44 GMT (envelope-from git) Date: Thu, 6 Jul 2023 07:57:44 GMT Message-Id: <202307060757.3667viac038253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: 9000459d3bc2 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9000459d3bc2816df3525cda8d3fa4eee6c92b26 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by otis: URL: https://cgit.FreeBSD.org/src/commit/?id=9000459d3bc2816df3525cda8d3fa4eee6c92b26 commit 9000459d3bc2816df3525cda8d3fa4eee6c92b26 Author: Juraj Lutter AuthorDate: 2023-06-06 11:40:49 +0000 Commit: Juraj Lutter CommitDate: 2023-07-06 07:56:35 +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 (cherry picked from commit e5d7100c09e03e66535eee69d7e454c01e4a9d28) --- usr.sbin/periodic/periodic.8 | 9 +++++++-- usr.sbin/periodic/periodic.conf | 6 +++--- usr.sbin/periodic/periodic.sh | 8 ++++++++ 3 files changed, 18 insertions(+), 5 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 4429c8d48eea..c14f4dd001db 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 84e14e9cfd80..97de8192dd28 100644 --- a/usr.sbin/periodic/periodic.sh +++ b/usr.sbin/periodic/periodic.sh @@ -30,6 +30,14 @@ 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:${_localbase}/sbin:${_localbase}/bin + # If possible, check the global system configuration file, # to see if there are additional dirs to check if [ -r /etc/defaults/periodic.conf ]; then