summaryrefslogtreecommitdiff
path: root/pre-install.d
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:12:05 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:12:05 -0500
commitef70e3d7e62671d0cadb2731e6965768f73ca290 (patch)
treee0470bd941f4d9f39068499265731e9e53818657 /pre-install.d
parent3021117f7b4e17041d96e4906fce90a1ccd0183e (diff)
* Added configuration options for highlevel and lowlevel package managers
in etckeeper.conf. * Only install apt hooks if apt is used. * Only add backup conffile exclusion to gitignore if dpkg is used. * Rename pre/post-apt.d to pre/post-install.d to allow the same directories to be used for other package managers. * Use the name of the highlevel package manager in commit messages.
Diffstat (limited to 'pre-install.d')
-rwxr-xr-xpre-install.d/50uncommitted-changes22
-rw-r--r--pre-install.d/README3
2 files changed, 25 insertions, 0 deletions
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
new file mode 100755
index 0000000..f8811ad
--- /dev/null
+++ b/pre-install.d/50uncommitted-changes
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
+ . /usr/share/debconf/confmodule
+ db_capb escape
+ db_title etckeeper
+
+ db_reset etckeeper/unclean || true
+ db_subst etckeeper/unclean STATUS $(git-status | debconf-escape -e) || true
+ db_input critical etckeeper/unclean || true
+ db_go || true
+ db_get etckeeper/unclean
+ if [ "$RET" = true ]; then
+ git add .
+ if ! git commit $GIT_COMMIT_OPTIONS -m "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
+ db_input critical etckeeper/commit_failed || true
+ db_go || true
+ db_reset etckeeper/commit_failed || true
+ fi
+ fi
+ db_reset etckeeper/unclean || true
+fi
diff --git a/pre-install.d/README b/pre-install.d/README
new file mode 100644
index 0000000..a3b5a57
--- /dev/null
+++ b/pre-install.d/README
@@ -0,0 +1,3 @@
+Files in this directory are run before packages are installed, upgraded,
+etc. This is mostly used for sanity checks, ie, does /etc have any
+uncommitted changes?