summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README9
-rwxr-xr-xinit.d/40git-pre-commit-hook2
-rw-r--r--post-apt.d/README2
-rwxr-xr-xpre-apt.d/50uncommitted-changes16
-rw-r--r--pre-apt.d/README2
-rwxr-xr-xpre-commit.d/10warn-empty-directory (renamed from pre-commit.d/10warn-empty)2
-rwxr-xr-xpre-commit.d/10warn-hardlinks2
-rwxr-xr-xpre-commit.d/10warn-special-file (renamed from pre-commit.d/10warn-special)2
8 files changed, 26 insertions, 11 deletions
diff --git a/README b/README
index f9a6115..2751eb7 100644
--- a/README
+++ b/README
@@ -28,10 +28,9 @@ repository.
etckeeper has special support to handle changes to /etc caused by
installing and upgrading packages. Before apt installs packages,
-`etckeeper-pre-apt` will check that /etc is clean, and if it's not, prompt
-you about whether or not to continue. (This check can be disabled.) After
-apt installs packages, `etckeeper-post-apt` will add any new interesting
-files to the repository, and commit the changes.
+`etckeeper-pre-apt` will check that /etc contains no uncommitted changes.
+After apt installs packages, `etckeeper-post-apt` will add any new
+interesting files to the repository, and commit the changes.
git is designed as a way to manage source code, not as a way to manage
arbitrary directories like /etc. This means it has a few limitations that
@@ -54,7 +53,7 @@ empty directory, if it's not significant, or put a file (such as
git doesn't support several special files that you _probably_ won't have in
/etc, such as unix sockets, named pipes, hardlinked files (but softlinks
-are fine), and device files. Again a git hooks are used to warn if your /etc
+are fine), and device files. Again git hooks are used to warn if your /etc
contains such untrackable special files.
diff --git a/init.d/40git-pre-commit-hook b/init.d/40git-pre-commit-hook
index a5b45d3..f1609eb 100755
--- a/init.d/40git-pre-commit-hook
+++ b/init.d/40git-pre-commit-hook
@@ -2,7 +2,7 @@
set -e
if [ -x .git/hooks/pre-commit ]; then
if ! grep -q etckeeper-pre-commit .git/hooks/pre-commit; then
- echo "warning: .git/hooks/pre-commit needs to be manually modifed to run etckeeper-pre-commit" >&2
+ echo "etckeeper warning: .git/hooks/pre-commit needs to be manually modifed to run etckeeper-pre-commit" >&2
fi
else
echo <<EOF >>.git/hooks/pre-commit
diff --git a/post-apt.d/README b/post-apt.d/README
index 34b65ac..befa5c0 100644
--- a/post-apt.d/README
+++ b/post-apt.d/README
@@ -1,2 +1,2 @@
Files in this directory are run after apt has run. They should commit
-changed and new files in the working directory to to repository.
+changes and new files in /etc to repository.
diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes
new file mode 100755
index 0000000..4c0c5ee
--- /dev/null
+++ b/pre-apt.d/50uncommitted-changes
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+cd /etc
+while git-status || ! LANG=C git-status 2>&1 | grep -q "working directory clean"
+do
+ echo "etckeeper warning: /etc has uncommitted changes" >&2
+ printf "Press Enter to commit these changes and continue. "
+ read line
+ git add .
+ if ! git commit -m "saving uncommitted changes in /etc prior to apt run"; then
+ echo "etckeeper warning: git commit failed" >&2
+ echo "Please resolve the uncommitted changes by hand."
+ printf "Press Enter when ready to continue. "
+ read line
+ fi
+done
diff --git a/pre-apt.d/README b/pre-apt.d/README
index aadbd4f..47001b4 100644
--- a/pre-apt.d/README
+++ b/pre-apt.d/README
@@ -1,2 +1,2 @@
Files in this directory are run before apt is run. This is mostly used for
-sanity checks, ie, does the working directory have any uncommitted changes?
+sanity checks, ie, does /etc have any uncommitted changes?
diff --git a/pre-commit.d/10warn-empty b/pre-commit.d/10warn-empty-directory
index 8dcb357..eed41ae 100755
--- a/pre-commit.d/10warn-empty
+++ b/pre-commit.d/10warn-empty-directory
@@ -2,6 +2,6 @@
set -e
empty=$(find -type f -empty | grep -v /.git/)
if [ -n "$empty" ]; then
- echo "warning: empty directories, not tracked by git:" >&2
+ echo "etckeeper warning: empty directories, not tracked by git:" >&2
echo "$empty" >&2
fi
diff --git a/pre-commit.d/10warn-hardlinks b/pre-commit.d/10warn-hardlinks
index f449fed..29f007b 100755
--- a/pre-commit.d/10warn-hardlinks
+++ b/pre-commit.d/10warn-hardlinks
@@ -2,6 +2,6 @@
set -e
hardlinks=$(find -type f -not -links 1 | grep -v /.git/)
if [ -n "$hardlinks" ]; then
- echo "warning: hardlinked files could cause problems with git:" >&2
+ echo "etckeeper warning: hardlinked files could cause problems with git:" >&2
echo "$hardlinks" >&2
fi
diff --git a/pre-commit.d/10warn-special b/pre-commit.d/10warn-special-file
index 92d1d3d..aa5c683 100755
--- a/pre-commit.d/10warn-special
+++ b/pre-commit.d/10warn-special-file
@@ -2,6 +2,6 @@
set -e
special=$(find -not -type d -not -type f -not -type l | grep -v /.git/)
if [ -n "$special" ]; then
- echo "warning: special files could cause problems with git:" >&2
+ echo "etckeeper warning: special files could cause problems with git:" >&2
echo "$special" >&2
fi