summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-05-17 10:34:27 -0400
committerJoey Hess <joeyh@joeyh.name>2016-05-17 10:34:27 -0400
commit7c734b05adf5a98be134008dfd7b5cc2c2b5a81d (patch)
treeac1b6c5ba7c899e587eb664f6c89a5e0a459f0f5
parent43e5d4b50766d4b9bc4317f1fef69cb2ed48fecf (diff)
refactor daily script
-rw-r--r--Makefile1
-rwxr-xr-xdaily (renamed from systemd/etckeeper)1
-rw-r--r--debian/cron.daily18
-rw-r--r--etckeeper.conf2
4 files changed, 5 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 206e44c..dd5178e 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ build: etckeeper.spec etckeeper.version
install: etckeeper.version
mkdir -p $(DESTDIR)$(etcdir)/etckeeper/ $(DESTDIR)$(vardir)/cache/etckeeper/
$(CP) *.d $(DESTDIR)$(etcdir)/etckeeper/
+ $(INSTALL_DATA) daily $(DESTDIR)$(etcdir)/etckeeper/
$(INSTALL_DATA) $(CONFFILE) $(DESTDIR)$(etcdir)/etckeeper/etckeeper.conf
mkdir -p $(DESTDIR)$(bindir)
$(INSTALL_EXE) etckeeper $(DESTDIR)$(bindir)/etckeeper
diff --git a/systemd/etckeeper b/daily
index 5255691..d35191a 100755
--- a/systemd/etckeeper
+++ b/daily
@@ -1,4 +1,5 @@
#!/bin/sh
+# 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
diff --git a/debian/cron.daily b/debian/cron.daily
index 5255691..e00e570 100644
--- a/debian/cron.daily
+++ b/debian/cron.daily
@@ -1,19 +1,5 @@
#!/bin/sh
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
- fi
- fi
+if [ -e /etc/etckeeper/daily ]; then
+ /etc/etckeeper/daily
fi
diff --git a/etckeeper.conf b/etckeeper.conf
index 0d268bd..b17dc2b 100644
--- a/etckeeper.conf
+++ b/etckeeper.conf
@@ -21,7 +21,7 @@ DARCS_COMMIT_OPTIONS="-a"
#AVOID_DAILY_AUTOCOMMITS=1
# Uncomment the following to avoid special file warning
-# (the option is enabled automatically by cronjob regardless).
+# (the option is enabled automatically for daily autocommits regardless).
#AVOID_SPECIAL_FILE_WARNING=1
# Uncomment to avoid etckeeper committing existing changes to