From a338fa4cee032ed09c6bd7a164c3bf0b18d5e66a Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 14 Oct 2015 11:36:53 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- cron.daily/etckeeper | 19 +++++++++++++ etckeeper/._cfg0000_etckeeper.conf | 44 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 cron.daily/etckeeper create mode 100644 etckeeper/._cfg0000_etckeeper.conf diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper new file mode 100755 index 00000000..5255691b --- /dev/null +++ b/cron.daily/etckeeper @@ -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 diff --git a/etckeeper/._cfg0000_etckeeper.conf b/etckeeper/._cfg0000_etckeeper.conf new file mode 100644 index 00000000..c1da4bf7 --- /dev/null +++ b/etckeeper/._cfg0000_etckeeper.conf @@ -0,0 +1,44 @@ +# The VCS to use. +#VCS="hg" +VCS="git" +#VCS="bzr" +#VCS="darcs" + +# Options passed to git commit when run by etckeeper. +GIT_COMMIT_OPTIONS="" + +# Options passed to hg commit when run by etckeeper. +HG_COMMIT_OPTIONS="" + +# Options passed to bzr commit when run by etckeeper. +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. +#AVOID_DAILY_AUTOCOMMITS=1 + +# Uncomment the following to avoid special file warning +# (the option is enabled automatically by cronjob regardless). +#AVOID_SPECIAL_FILE_WARNING=1 + +# Uncomment to avoid etckeeper committing existing changes to +# /etc before installation. It will cancel the installation, +# so you can commit the changes by hand. +#AVOID_COMMIT_BEFORE_INSTALL=1 + +# The high-level package manager that's being used. +# (apt, pacman-g2, yum, zypper etc) +# For gentoo this is emerge +HIGHLEVEL_PACKAGE_MANAGER=emerge + +# The low-level package manager that's being used. +# (dpkg, rpm, pacman, pacman-g2, etc) +# For gentoo this is qlist +LOWLEVEL_PACKAGE_MANAGER=qlist + +# To push each commit to a remote, put the name of the remote here. +# (eg, "origin" for git). +PUSH_REMOTE="" -- 2.39.5