summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-05-17 10:41:00 -0400
committerJoey Hess <joeyh@joeyh.name>2016-05-17 10:41:00 -0400
commit63097d804766a1a3cca7b8c4afb245ec7c6479f6 (patch)
treed1842b9d2398f6aea1dc5c777cca28b9279035e7
parent7c734b05adf5a98be134008dfd7b5cc2c2b5a81d (diff)
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.
-rwxr-xr-xdaily23
-rw-r--r--debian/changelog3
-rw-r--r--debian/cron.daily7
-rw-r--r--etckeeper.conf6
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 <id@joeyh.name> 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