From 63097d804766a1a3cca7b8c4afb245ec7c6479f6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 May 2016 10:41:00 -0400 Subject: AVOID_DAILY_AUTOCOMMITS only disables the cron job The systemd timer can be disabled by running systemctl, so it's redundant to have another way to disable it. And, users will want to disable the cron job when enabling the timer. --- daily | 23 ++++++++++------------- debian/changelog | 3 +++ debian/cron.daily | 7 +++++-- etckeeper.conf | 6 ++++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/daily b/daily index d35191a..f98c6ad 100755 --- a/daily +++ b/daily @@ -2,19 +2,16 @@ # Script that can be run daily to autocommit /etc changes. set -e if [ -x /usr/bin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then - . /etc/etckeeper/etckeeper.conf - if [ "$AVOID_DAILY_AUTOCOMMITS" != "1" ]; then - # 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 - rm -f "$lockfile" # stale - fi - if [ ! -e "$lockfile" ]; then - AVOID_SPECIAL_FILE_WARNING=1 - export AVOID_SPECIAL_FILE_WARNING - if etckeeper unclean; then - etckeeper commit "daily autocommit" >/dev/null - 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 + rm -f "$lockfile" # stale + fi + if [ ! -e "$lockfile" ]; then + AVOID_SPECIAL_FILE_WARNING=1 + export AVOID_SPECIAL_FILE_WARNING + if etckeeper unclean; then + etckeeper commit "daily autocommit" >/dev/null fi fi fi diff --git a/debian/changelog b/debian/changelog index 77c3b4a..aeaea9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ etckeeper (1.18.4) UNRELEASED; urgency=medium Thanks, Tilman Blumenbach and Christian Hesse. * Only run Pacman hooks when files in /etc have changed. Thanks, Christian Hesse. + * Added systemd timer that can run etckeeper 10 minutes after boot, and also + daily. It's not enabled by default, partly because of overlap with the + cron job. -- Joey Hess Mon, 29 Feb 2016 11:12:08 -0400 diff --git a/debian/cron.daily b/debian/cron.daily index e00e570..eb74401 100644 --- a/debian/cron.daily +++ b/debian/cron.daily @@ -1,5 +1,8 @@ #!/bin/sh set -e -if [ -e /etc/etckeeper/daily ]; then - /etc/etckeeper/daily +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 fi diff --git a/etckeeper.conf b/etckeeper.conf index b17dc2b..0fb660b 100644 --- a/etckeeper.conf +++ b/etckeeper.conf @@ -16,8 +16,10 @@ BZR_COMMIT_OPTIONS="" # Options passed to darcs record when run by etckeeper. DARCS_COMMIT_OPTIONS="-a" -# Uncomment to avoid etckeeper committing existing changes -# to /etc automatically once per day. +# Etckeeper includes both a cron job and a systemd timer, which each +# can commit exiting changes to /etc automatically once per day. +# To enable the systemd timer, run: systemctl enable etckeeper.timer +# The cron job is enabled by default; to disable it, uncomment this next line. #AVOID_DAILY_AUTOCOMMITS=1 # Uncomment the following to avoid special file warning -- cgit v1.2.3