From bd90bdd96e1ef36059651f68d0c3fb0a60e74d38 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 10 Nov 2007 20:08:34 -0500 Subject: use debconf for prompting pre-apt --- TODO | 3 --- debian/po/POTFILES.in | 1 + debian/postinst | 7 +++++++ debian/rules | 1 + debian/templates | 16 ++++++++++++++++ pre-apt.d/50uncommitted-changes | 27 +++++++++++++++++---------- 6 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 debian/po/POTFILES.in create mode 100644 debian/postinst create mode 100644 debian/templates 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 &2 - echo "Please resolve the uncommitted changes by hand." - printf "Press Enter when ready to continue. " - read line