PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1#!/bin/sh
 2set -e
 3
 4if [ "$1" = "fail-debconf" ]; then
 5	. /usr/share/debconf/confmodule
 6	db_subst etckeeper/commit_failed VCS "$VCS"
 7	db_input critical etckeeper/commit_failed || true
 8	db_go || true
 9	db_reset etckeeper/commit_failed || true
10	exit 0
11fi
12
13if etckeeper unclean; then
14	if [ "$AVOID_COMMIT_BEFORE_INSTALL" = 1 ]; then
15		echo "" >&2
16		echo "** etckeeper detected uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run" >&2 
17		echo "** Aborting $HIGHLEVEL_PACKAGE_MANAGER run. Manually commit and restart." >&2
18		echo "" >&2
19		exit 1
20	fi
21	if ! etckeeper commit "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
22		if [ -e /usr/share/debconf/confmodule ]; then
23			$0 fail-debconf
24		else
25			echo "error: etckeeper failed to commit changes in /etc using $VCS"
26			exit 1
27		fi
28	fi
29fi