summaryrefslogtreecommitdiff
path: root/pre-apt.d/50uncommitted-changes
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-10 20:08:34 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-10 20:08:34 -0500
commitbd90bdd96e1ef36059651f68d0c3fb0a60e74d38 (patch)
tree5e0033bc231913ae01ee3ed501f333a4f56c770c /pre-apt.d/50uncommitted-changes
parent8bee13cefc2fb907c2be20fd7d83de4f829502ea (diff)
use debconf for prompting pre-apt
Diffstat (limited to 'pre-apt.d/50uncommitted-changes')
-rwxr-xr-xpre-apt.d/50uncommitted-changes27
1 files changed, 17 insertions, 10 deletions
diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes
index c8e4736..e394db1 100755
--- a/pre-apt.d/50uncommitted-changes
+++ b/pre-apt.d/50uncommitted-changes
@@ -1,15 +1,22 @@
#!/bin/sh
set -e
if ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
- git-status || true
- echo "etckeeper warning: /etc is not clean" >&2
- printf "Press Enter to commit changes and continue. "
- read line </dev/tty
- git add .
- if ! git commit -m "saving uncommitted changes in /etc prior to apt run"; then
- echo "etckeeper warning: git commit failed" >&2
- echo "Please resolve the uncommitted changes by hand."
- printf "Press Enter when ready to continue. "
- read line </dev/tty
+ . /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 -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