From nobody Tue Jan 30 11:44:34 2024 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 4TPNcg1WY8z58hTs; Tue, 30 Jan 2024 11:44:35 +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 4TPNcf6GcXz4PCB; Tue, 30 Jan 2024 11:44:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706615074; 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=RNbvY1gKmsHSoCg2s6LFxaYQZqSTwqzzI5Ce71XiZnQ=; b=rm8F2+yHMn+L0VZxx7XZbW8/gITtBBeHcEKrGD3D4OhCXdkQ/Y4mwSU3UjEf++sns324ht 2Omc1FI/rVOuDoIp6xMgGRshrcMOs6P0uhTRW9r9w3lVyVJDCOa1Fvta0XPo5wqC+nMWSv kdsemYqZdEUWi4JiVKkfNAPkx0m1yO4mde0FPi3A40hhO+tfHxKU/KVan3S5sRX/mfAgf0 LQrufwnpLK5cJgbXQ3bDmmJ2SKRcK+T9+WyqTCdirkJ+vghMdzyCGQunouH8FSZFNRafdP glpWSkuuvngx6jyxIbUzEakTYD9Yxg3gDIvFUjFc8KgNNXmrVDJQkDA4Qgi/sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706615074; 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=RNbvY1gKmsHSoCg2s6LFxaYQZqSTwqzzI5Ce71XiZnQ=; b=vJSH1AsUzND1T9rcfxXwGTQeVkpsYXqAgLPSvjaximIxnT+bsB2k12I8iUqBTWC2O19zc9 +qbP1nSQRu7TqGPSPhqUhmzJWTRmBJeEL/MIkvJTz2A1V7MpDSFP9r8XWe4tM7XDPHU+vm L9AuSKRriCEWco5ZpdxSybddyze4S8yZL2oAZ34kEDCQmpWpWS0CCagElQOrPRjIAU+34w 3Wy8dZj/HdPJ6bTlTKf4Z+2MMKa2Zj0ahTk9wN9SlClkhYmBYs6bk3UbEull0d+G/Z+YfY YNPRAWM6QHhP3pxwI8EDB08ge0fRmeQpScDom5vAOYl+66jFoQulQ3F2vbbhZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706615074; a=rsa-sha256; cv=none; b=INggalUXgD2cd3NaQrsaJUxCF3S6GwvL/s6EFK5ON96ZnLJFfASTM1bg4NEYZOVbysbsAI sARS5zbHJ4Yz9wHtNOPyOPXdSp3Tu57MdIbGycK3qQpE+ahYNpxjoIP/PW8dvIdUZIzeg4 oTMxjpoAPZJ/D/oNr5S6ti0WbB209kbwTNWpN1MjbV0YWe7ky895O/8szdhxUJtAffP4nq IvBkjLm/VGGfjC+9osRG9gI2xQuxJ3pw7+cju9WsZ1XKwkLUL3zvEEC0eT9ekF7pJj10Ab wn7ALT5TYpnIJFd5NG04ULMVSHIc7gQJP/GMl/z5QiBhPufOaryJ6yDOyXO1GQ== 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 4TPNcf5KY5zZqt; Tue, 30 Jan 2024 11:44:34 +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 40UBiY73042882; Tue, 30 Jan 2024 11:44:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40UBiYPO042879; Tue, 30 Jan 2024 11:44:34 GMT (envelope-from git) Date: Tue, 30 Jan 2024 11:44:34 GMT Message-Id: <202401301144.40UBiYPO042879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Osipov Subject: git: 6455c2cf85a9 - stable/13 - periodic: Make daily diff(1) flags configurable with daily_diff_flags 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: michaelo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6455c2cf85a920577dfe6bced32f97d9216abc73 Auto-Submitted: auto-generated The branch stable/13 has been updated by michaelo: URL: https://cgit.FreeBSD.org/src/commit/?id=6455c2cf85a920577dfe6bced32f97d9216abc73 commit 6455c2cf85a920577dfe6bced32f97d9216abc73 Author: Michael Osipov AuthorDate: 2023-11-24 09:26:41 +0000 Commit: Michael Osipov CommitDate: 2024-01-30 11:43:54 +0000 periodic: Make daily diff(1) flags configurable with daily_diff_flags PR: 270266 Approved by: jrm (mentor), karels MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D42900 (cherry picked from commit 15e35d058cff847d1a7bc671fcf48b99f5d2f73b) --- share/man/man5/periodic.conf.5 | 5 +++++ usr.sbin/periodic/etc/daily/200.backup-passwd | 4 ++-- usr.sbin/periodic/etc/daily/210.backup-aliases | 2 +- usr.sbin/periodic/etc/daily/221.backup-gpart | 2 +- usr.sbin/periodic/etc/daily/222.backup-gmirror | 2 +- usr.sbin/periodic/etc/daily/223.backup-zfs | 2 +- usr.sbin/periodic/periodic.conf | 1 + 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 6043263f3e3a..1edc8bf14767 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -645,6 +645,11 @@ but specific to the pool Set to a list of extra scripts that should be run after all other daily scripts. All scripts must be absolute path names. +.It Va daily_diff_flags +.Pq Vt str +Set to the arguments to pass to the +.Xr diff 1 +utility when generating differences. .El .Pp The following variables are used by the standard scripts that reside in diff --git a/usr.sbin/periodic/etc/daily/200.backup-passwd b/usr.sbin/periodic/etc/daily/200.backup-passwd index 44da5993a3a6..e165e7f0f0ed 100755 --- a/usr.sbin/periodic/etc/daily/200.backup-passwd +++ b/usr.sbin/periodic/etc/daily/200.backup-passwd @@ -40,7 +40,7 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" - diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ + diff ${daily_diff_flags:--u} -I '^#' $bak/master.passwd.bak /etc/master.passwd |\ sed 's/^\([-+ ][^:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 @@ -57,7 +57,7 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host group diffs:" - diff -u $bak/group.bak /etc/group + diff ${daily_diff_flags:--u} $bak/group.bak /etc/group mv $bak/group.bak $bak/group.bak2 cp -p /etc/group $bak/group.bak || rc=3 fi diff --git a/usr.sbin/periodic/etc/daily/210.backup-aliases b/usr.sbin/periodic/etc/daily/210.backup-aliases index 3b689e3eaa1b..25e2bd021a84 100755 --- a/usr.sbin/periodic/etc/daily/210.backup-aliases +++ b/usr.sbin/periodic/etc/daily/210.backup-aliases @@ -34,7 +34,7 @@ case "$daily_backup_aliases_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host aliases diffs:" - diff -u $bak/aliases.bak /etc/mail/aliases + diff ${daily_diff_flags:--u} $bak/aliases.bak /etc/mail/aliases mv $bak/aliases.bak $bak/aliases.bak2 cp -p /etc/mail/aliases $bak/aliases.bak || rc=3 fi diff --git a/usr.sbin/periodic/etc/daily/221.backup-gpart b/usr.sbin/periodic/etc/daily/221.backup-gpart index da59a6d5d724..50096e38f118 100755 --- a/usr.sbin/periodic/etc/daily/221.backup-gpart +++ b/usr.sbin/periodic/etc/daily/221.backup-gpart @@ -27,7 +27,7 @@ rotate() { rm "${file}.tmp" else rc=1 - [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" + [ -n "$show_diff" ] && diff ${daily_diff_flags} "${file}.bak" "${file}.tmp" mv "${file}.bak" "${file}.bak2" || rc=3 mv "${file}.tmp" "${file}.bak" || rc=3 fi diff --git a/usr.sbin/periodic/etc/daily/222.backup-gmirror b/usr.sbin/periodic/etc/daily/222.backup-gmirror index 866a00497759..45c656dc4f41 100755 --- a/usr.sbin/periodic/etc/daily/222.backup-gmirror +++ b/usr.sbin/periodic/etc/daily/222.backup-gmirror @@ -25,7 +25,7 @@ rotate() { rm "${file}.tmp" else rc=1 - [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" + [ -n "$show_diff" ] && diff ${daily_diff_flags} "${file}.bak" "${file}.tmp" mv "${file}.bak" "${file}.bak2" || rc=3 mv "${file}.tmp" "${file}.bak" || rc=3 fi diff --git a/usr.sbin/periodic/etc/daily/223.backup-zfs b/usr.sbin/periodic/etc/daily/223.backup-zfs index 03876df53f13..a49bbb2eaa04 100755 --- a/usr.sbin/periodic/etc/daily/223.backup-zfs +++ b/usr.sbin/periodic/etc/daily/223.backup-zfs @@ -25,7 +25,7 @@ rotate() { rm "${file}.tmp" else rc=1 - [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" + [ -n "$show_diff" ] && diff ${daily_diff_flags} "${file}.bak" "${file}.tmp" mv "${file}.bak" "${file}.bak2" || rc=3 mv "${file}.tmp" "${file}.bak" || rc=3 fi diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf index 2da2ac1ae384..6f52f3f1aacf 100644 --- a/usr.sbin/periodic/periodic.conf +++ b/usr.sbin/periodic/periodic.conf @@ -31,6 +31,7 @@ anticongestion_sleeptime=3600 # that output. $daily_output might be set to /var/log/daily.log if you # wish to log the daily output and have the files rotated by newsyslog(8) # +daily_diff_flags="" # flags for diff output daily_output="root" # user or /file daily_show_success="YES" # scripts returning 0 daily_show_info="YES" # scripts returning 1