Hi,

as mentioned in my last email, here is a patch that make etckeepker/daily honor 
the setting AVOID_DAILY_AUTOCOMMITS=1 in the configuration file and doesn't 
fail if the variable is unset. I also went ahead and removed the check from 
cron.daily/etckeeper so it's not performed twice when the cronjob is run. 
Please note, that this patch only applies cleanly if my patch sent for bug 
#883263 is applied first. But technically it's not required as it's just the 
context that is different.

Regards,

Timo
>From 36864b49b56b20198ee01f302ebdedd3e15c9d58 Mon Sep 17 00:00:00 2001
From: Timo Sigurdsson <public_tim...@silentcreek.de>
Date: Fri, 17 Apr 2020 19:23:19 +0200
Subject: [PATCH] Fix Debian etckeeper bug #884824.

---
 cron.daily/etckeeper | 8 +++-----
 etckeeper/daily      | 6 ++++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper
index 3266faa..ade2a2a 100755
--- a/cron.daily/etckeeper
+++ b/cron.daily/etckeeper
@@ -5,9 +5,7 @@ if [ -d /run/systemd/system ] && [ -x /bin/systemctl ] && /bin/systemctl -q is-active etckeeper.timer; then
 	exit 0
 fi
 
-if [ -e /etc/etckeeper/daily ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
-	. /etc/etckeeper/etckeeper.conf
-	if [ "$AVOID_DAILY_AUTOCOMMITS" != "1" ]; then
-		/etc/etckeeper/daily
-	fi
+# The etckeeper/daily script checks if daily autocommits are disabled.
+if [ -x /etc/etckeeper/daily ]; then
+	/etc/etckeeper/daily
 fi
diff --git a/etckeeper/daily b/etckeeper/daily
index f98c6ad..276c84e 100755
--- a/etckeeper/daily
+++ b/etckeeper/daily
@@ -2,6 +2,12 @@
 # Script that can be run daily to autocommit /etc changes.
 set -e
 if [ -x /usr/bin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
+	# check if daily autocommits are disabled (Debian bug #884824)
+	. /etc/etckeeper/etckeeper.conf
+	if [ "$AVOID_DAILY_AUTOCOMMITS" = "1" ]; then
+		exit 0
+	fi
+
 	# avoid autocommit if an install run is in progress
 	lockfile=/var/cache/etckeeper/packagelist.pre-install
 	if [ -e "$lockfile" ] && [ -n "$(find "$lockfile" -mtime +1)" ]; then
-- 
2.20.1

Reply via email to