other development too..
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
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.
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
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.
--- /dev/null
+#!/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
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?
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
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
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