summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--debian/po/POTFILES.in1
-rw-r--r--debian/postinst7
-rwxr-xr-xdebian/rules1
-rw-r--r--debian/templates16
-rwxr-xr-xpre-apt.d/50uncommitted-changes27
6 files changed, 42 insertions, 13 deletions
diff --git a/TODO b/TODO
index a8050a2..4bcd9a9 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,3 @@
-* use debconf for the pre-apt prompting, so it will work better when run from
- frontend like synaptic
-
* keep an origin branch with the files debian ships
Not sure quite how to do this yet, it seems it would need to clone
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..cef83a3
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..e0c6707
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+# source confmodule to ensure templates are loaded
+. /usr/share/debconf/confmodule
+
+#DEBHELPER
diff --git a/debian/rules b/debian/rules
index cfd37c1..b56b152 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,6 +20,7 @@ binary-indep: build
dh_installchangelogs
dh_compress
dh_fixperms
+ dh_installdebconf
dh_installdeb
dh_gencontrol
dh_md5sums
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 0000000..3919b6a
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,16 @@
+Template: etckeeper/unclean
+Type: boolean
+Default: true
+_Description: Commit changed files in /etc to git?
+ etckeeper has detected that /etc contains uncommitted files
+ or other changes. It's best to have everything in /etc committed
+ to git before running apt. etckeeper can add any new files listed below,
+ and commit all the changed files for you.
+ .
+ ${STATUS}
+
+Template: etckeeper/commit_failed
+Type: error
+_Description: git commit failed
+ etckeeper failed to commit changes in /etc using git.
+ You may want to resolve the uncommitted changes by hand before continuing.
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