summaryrefslogtreecommitdiff
path: root/hg/pre-apt.d/50uncommitted-changes
blob: 62d62c3bdce548360a4073a36803546f701967c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
set -e
if [ -d .hg ] && ! hg status 2>&1 | wc -l | grep -q "^0$"; then
	. /usr/share/debconf/confmodule
	db_capb escape
	db_title etckeeper

	db_reset etckeeper/unclean || true
	db_subst etckeeper/unclean STATUS $(hg status | debconf-escape -e) || true
	db_input critical etckeeper/unclean || true
	db_go || true
	db_get etckeeper/unclean
	if [ "$RET" = true ]; then
		hg addremove .
		if ! hg commit $GIT_COMMIT_OPTIONS -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