/etckeeper/pre-install.d/50uncommitted-changes
http://github.com/brinkman83/bashrc · Shell · 29 lines · 26 code · 2 blank · 1 comment · 8 complexity · bfdaeac839e6788fcfd3a6bdd0839362 MD5 · raw file
- #!/bin/sh
- set -e
- if [ "$1" = "fail-debconf" ]; then
- . /usr/share/debconf/confmodule
- 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
- if etckeeper unclean; then
- if [ "$AVOID_COMMIT_BEFORE_INSTALL" = 1 ]; then
- echo "" >&2
- echo "** etckeeper detected uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run" >&2
- echo "** Aborting $HIGHLEVEL_PACKAGE_MANAGER run. Manually commit and restart." >&2
- echo "" >&2
- exit 1
- fi
- if ! etckeeper commit "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; 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