summaryrefslogtreecommitdiff
path: root/git/pre-apt.d/50uncommitted-changes
diff options
context:
space:
mode:
Diffstat (limited to 'git/pre-apt.d/50uncommitted-changes')
-rw-r--r--git/pre-apt.d/50uncommitted-changes22
1 files changed, 22 insertions, 0 deletions
diff --git a/git/pre-apt.d/50uncommitted-changes b/git/pre-apt.d/50uncommitted-changes
new file mode 100644
index 0000000..d39401c
--- /dev/null
+++ b/git/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