summaryrefslogtreecommitdiff
path: root/hg/pre-apt.d
diff options
context:
space:
mode:
authorMathieu Clabaut <mathieu.clabaut@gmail.com>2007-12-21 15:47:30 -0600
committerJoey Hess <joey@kodama.kitenet.net>2008-01-03 19:53:46 -0500
commitf82235032f162aae0bb08828d45c6306e60dcd29 (patch)
treea4479471b8b8c91903e1ceaf54dfea42e3457a4a /hg/pre-apt.d
parent631af60701ca747861d67a19d431005c7d45d6be (diff)
hg and git subrepo creation (hg is for now a copy of git)
Diffstat (limited to 'hg/pre-apt.d')
-rw-r--r--hg/pre-apt.d/50uncommitted-changes22
-rw-r--r--hg/pre-apt.d/README2
2 files changed, 24 insertions, 0 deletions
diff --git a/hg/pre-apt.d/50uncommitted-changes b/hg/pre-apt.d/50uncommitted-changes
new file mode 100644
index 0000000..d39401c
--- /dev/null
+++ b/hg/pre-apt.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 apt 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/hg/pre-apt.d/README b/hg/pre-apt.d/README
new file mode 100644
index 0000000..47001b4
--- /dev/null
+++ b/hg/pre-apt.d/README
@@ -0,0 +1,2 @@
+Files in this directory are run before apt is run. This is mostly used for
+sanity checks, ie, does /etc have any uncommitted changes?