]> Frank Brehm's Git Trees - config/samara/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorroot Samara <root@samara.pb.local>
Wed, 14 Oct 2015 07:39:43 +0000 (09:39 +0200)
committerroot Samara <root@samara.pb.local>
Wed, 14 Oct 2015 07:39:43 +0000 (09:39 +0200)
cron.daily/etckeeper [new file with mode: 0755]

diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper
new file mode 100755 (executable)
index 0000000..5255691
--- /dev/null
@@ -0,0 +1,19 @@
+#!/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
+fi