summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-06-07 16:11:59 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-06-07 16:11:59 -0400
commita3f643fc9d8fc4b45c1bed3cfa8415afb9eb3873 (patch)
tree7cd755972c5a414879ba4c57d615aeee5325a918
parent7ec9cb9061e580733a6f4b45bbde5f6db670c5c9 (diff)
Add a AVOID_COMMIT_BEFORE_INSTALL option in the config file to make it easy to configure etckeeper to abort an installation if there are uncommitted changes in /etc. Closes: #478754
-rw-r--r--debian/changelog8
-rwxr-xr-xetckeeper3
-rw-r--r--etckeeper.conf5
-rwxr-xr-xpre-install.d/50uncommitted-changes4
4 files changed, 20 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 3670a91..661548a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+etckeeper (0.16) UNRELEASED; urgency=low
+
+ * Add a AVOID_COMMIT_BEFORE_INSTALL option in the config file to make it
+ easy to configure etckeeper to abort an installation if there are
+ uncommitted changes in /etc. Closes: #478754
+
+ -- Joey Hess <joeyh@debian.org> Sat, 07 Jun 2008 16:07:09 -0400
+
etckeeper (0.15) unstable; urgency=low
[ Daniel Hahler ]
diff --git a/etckeeper b/etckeeper
index 49d1063..01bf326 100755
--- a/etckeeper
+++ b/etckeeper
@@ -33,6 +33,9 @@ fi
if [ ! -z "$LOWLEVEL_PACKAGE_MANAGER" ]; then
export LOWLEVEL_PACKAGE_MANAGER
fi
+if [ ! -z "$AVOID_COMMIT_BEFORE_INSTALL" ]; then
+ export AVOID_COMMIT_BEFORE_INSTALL
+fi
if [ -z "$1" ]; then
usage
diff --git a/etckeeper.conf b/etckeeper.conf
index f7a7ddf..f1438ab 100644
--- a/etckeeper.conf
+++ b/etckeeper.conf
@@ -12,6 +12,11 @@ VCS="git"
# Options passed to bzr commit when run by etckeeper.
#BZR_COMMIT_OPTIONS=""
+# 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.
HIGHLEVEL_PACKAGE_MANAGER=apt
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
index d06883d..465b06c 100755
--- a/pre-install.d/50uncommitted-changes
+++ b/pre-install.d/50uncommitted-changes
@@ -10,6 +10,10 @@ if [ "$1" = "fail-debconf" ]; then
fi
if etckeeper unclean; then
+ if [ ! "$AVOID_COMMIT_BEFORE_INSTALL" ]; then
+ echo "error: etckeeper detected uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run" >&2
+ exit 1
+ fi
if ! etckeeper commit "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
if [ -e /usr/share/debconf/confmodule ]; then
$0 fail-debconf