diff options
author | Joey Hess <joey@kitenet.net> | 2014-09-04 15:43:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-09-04 15:43:19 -0400 |
commit | 5db7670623c2551c5cc1f6dc8ce02543b06cf671 (patch) | |
tree | 6e613e089dde3ece817d7da584113f8eaa2b2911 | |
parent | 81d3328154d544d4e857810a81e6080105065e5f (diff) |
Use debconf for prompting when post-install commit fails, as was already done for pre-install commit. This avoids propigating errors to apt when eg, git is misconfigured and cannot commit. Closes: #760011
-rw-r--r-- | debian/changelog | 9 | ||||
-rwxr-xr-x | post-install.d/50vcs-commit | 22 | ||||
-rwxr-xr-x | pre-install.d/50uncommitted-changes | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 1575d89..e11e941 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +etckeeper (1.14) UNRELEASED; urgency=medium + + * Use debconf for prompting when post-install commit fails, as was + already done for pre-install commit. This avoids propigating + errors to apt when eg, git is misconfigured and cannot commit. + Closes: #760011 + + -- Joey Hess <joeyh@debian.org> Thu, 04 Sep 2014 15:41:39 -0400 + etckeeper (1.13) unstable; urgency=medium * Ignore check-mk-agent-logwatch's FHS violating diff --git a/post-install.d/50vcs-commit b/post-install.d/50vcs-commit index 7710c4a..edd3444 100755 --- a/post-install.d/50vcs-commit +++ b/post-install.d/50vcs-commit @@ -1,11 +1,22 @@ #!/bin/sh set -e + +if [ "$1" = "fail-debconf" ]; then + . /usr/share/debconf/confmodule + db_title etckeeper + db_subst etckeeper/commit_failed VCS "$VCS" + db_input critical etckeeper/commit_failed || true + db_go || true + db_reset etckeeper/commit_failed || true + exit 0 +fi pl="/var/cache/etckeeper/packagelist" if etckeeper unclean; then message="committing changes in /etc after $HIGHLEVEL_PACKAGE_MANAGER run" + set +e if [ -e $pl.pre-install ]; then ( echo "$message" @@ -16,6 +27,17 @@ if etckeeper unclean; then else etckeeper commit "$(printf "$message")" fi + status=$? + set -e + + if [ "$status" != 0 ]; then + if [ -e /usr/share/debconf/confmodule ]; then + $0 fail-debconf + else + echo "error: etckeeper failed to commit changes in /etc using $VCS" + exit 1 + fi + fi fi if [ -e $pl.pre-install ]; then diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes index d03d0e8..ef3fbf1 100755 --- a/pre-install.d/50uncommitted-changes +++ b/pre-install.d/50uncommitted-changes @@ -3,6 +3,7 @@ set -e if [ "$1" = "fail-debconf" ]; then . /usr/share/debconf/confmodule + db_title etckeeper db_subst etckeeper/commit_failed VCS "$VCS" db_input critical etckeeper/commit_failed || true db_go || true |