summaryrefslogtreecommitdiff
path: root/pre-install.d/50uncommitted-changes
diff options
context:
space:
mode:
Diffstat (limited to 'pre-install.d/50uncommitted-changes')
-rwxr-xr-xpre-install.d/50uncommitted-changes15
1 files changed, 15 insertions, 0 deletions
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
new file mode 100755
index 0000000..969d341
--- /dev/null
+++ b/pre-install.d/50uncommitted-changes
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+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
+ echo "warning: etckeeper failed to commit changes in /etc using $VCS" >&2
+ fi
+fi