summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL5
-rw-r--r--Makefile14
-rw-r--r--README20
-rw-r--r--TODO11
-rw-r--r--apt.conf4
-rw-r--r--bash_completion8
-rw-r--r--debian/changelog44
-rw-r--r--debian/control2
-rw-r--r--debian/postinst30
-rw-r--r--debian/preinst29
-rwxr-xr-xetckeeper14
-rw-r--r--etckeeper.115
-rw-r--r--etckeeper.conf10
-rwxr-xr-xinit.d/40git-init2
-rwxr-xr-xinit.d/50git-ignore20
-rwxr-xr-xinit.d/70git-add4
-rw-r--r--pacman-g2.hook17
-rwxr-xr-xpost-apt.d/30git-add7
-rwxr-xr-xpost-apt.d/50git-commit12
-rw-r--r--post-apt.d/README2
-rwxr-xr-xpost-install.d/10git-test6
-rwxr-xr-xpost-install.d/30git-add7
-rwxr-xr-xpost-install.d/40git-rm (renamed from post-apt.d/40git-rm)2
-rwxr-xr-xpost-install.d/50git-commit9
-rw-r--r--post-install.d/README2
-rwxr-xr-xpre-apt.d/50uncommitted-changes22
-rw-r--r--pre-apt.d/README2
-rwxr-xr-xpre-install.d/50uncommitted-changes33
-rw-r--r--pre-install.d/README3
29 files changed, 278 insertions, 78 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..56c26e7
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,5 @@
+Before running 'make install', you should edit etckeeper.conf and make sure
+it configured appropriately for your distribution.
+
+Distribution packagers may find it more convenient to set CONFFILE to point
+to a different etckeeper.conf that is preconfigured for your distribution.
diff --git a/Makefile b/Makefile
index 30a60b8..a96bb1b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,18 @@
+# You should configure etckeeper.conf for your distribution before
+# installing etckeeper.
+CONFFILE=etckeeper.conf
+include $(CONFFILE)
+
install:
mkdir -p $(PREFIX)/etc/etckeeper/
cp -a *.d $(PREFIX)/etc/etckeeper/
+ cp $(CONFFILE) $(PREFIX)/etc/etckeeper/etckeeper.conf
install -D etckeeper $(PREFIX)/usr/bin/etckeeper
- install -m 0644 -D apt.conf $(PREFIX)/etc/apt/apt.conf.d/05etckeeper
install -m 0644 -D etckeeper.1 $(PREFIX)/usr/share/man/man1/etckeeper.1
+ install -m 0644 -D bash_completion $(PREFIX)/etc/bash_completion.d/etckeeper
+ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),apt))
+ install -m 0644 -D apt.conf $(PREFIX)/etc/apt/apt.conf.d/05etckeeper
+endif
+ifeq ($(LOWLEVEL_PACKAGE_MANAGER),pacman-g2))
+ install -m 0644 -D pacman-g2.hook $(PREFIX)/etc/pacman-g2/hooks/etckeeper
+endif
diff --git a/README b/README
index 7ec20b2..6dbffeb 100644
--- a/README
+++ b/README
@@ -33,8 +33,8 @@ So don't use it on git repositories from untrusted sources.
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 contains no uncommitted changes.
-After apt installs packages, `etckeeper post-apt` will add any new
+`etckeeper pre-install` will check that /etc contains no uncommitted changes.
+After apt installs packages, `etckeeper post-install` 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
@@ -66,7 +66,7 @@ A quick walkthrough of using etckeeper. The `etckeeper init` command
initialises an /etc/.git/ repository. This command is careful to never
overwrite existing files or directories in /etc. It will create a `.gitignore`
if one doesn't already exist, sets up git hooks if they don't already exist,
-and so on. It does *not* commit any files into to git, but does `git-add` all
+and so on. It does *not* commit any files into to git, but does `git add` all
interesting files for an initial commit.
etckeeper init
@@ -106,7 +106,7 @@ make sure you run "etckeeper init" again, to get any metadata changes:
etckeeper init
Often it's better to clone /etc to elsewhere and do potentially dangerous
-stuff in a staging directory. You can clone the repository using git-clone,
+stuff in a staging directory. You can clone the repository using git clone,
but be careful that the directory it's cloned into starts out mode 700, to
prevent anyone else from seeing files like shadow, before `etckeeper init`
fixes their permissions:
@@ -120,7 +120,7 @@ fixes their permissions:
chmod 755 ..
Another common reason to clone the repository is to make a backup to a
-server. When using git-push to create a new remote clone, make sure the new
+server. When using git push to create a new remote clone, make sure the new
remote clone is mode 700! (And, obviously, only push over a secure
transport like ssh, and only to a server you trust.)
@@ -143,16 +143,16 @@ action.
For example, here's how to configure it to run `git gc` after each apt run,
which will save a lot of disk space:
- cd /etc/etckeeper/post-apt.d
- (echo '#!/bin/sh' ; echo 'exec git-gc') > 99git-gc
+ cd /etc/etckeeper/post-install.d
+ (echo '#!/bin/sh' ; echo 'exec git gc') > 99git-gc
chmod +x 99git-gc
git add .
- git-commit -m "run git-gc after each apt run"
+ git commit -m "run git gc after each apt run"
Here's how to disable the automatic commits after each apt run, while still
-letting it git-add new files and git-rm removed ones:
+letting it git add new files and git rm removed ones:
- chmod -x /etc/etckeeper/post-apt.d/75git-commit
+ chmod -x /etc/etckeeper/post-install.d/75git-commit
Note that the etckeeper commands are careful to not hardcode anything about
git. If you want to use some other revision control system, that's
diff --git a/TODO b/TODO
index 4bcd9a9..245f3a4 100644
--- a/TODO
+++ b/TODO
@@ -17,7 +17,10 @@
in one repo, and public in another. This would need either symlink
farming or git "fake bare" repos, both of which are not pleasant, yet.
- Another way would be to allow splitting out subdirs into their own
- repos. This is already doable, would just need modifying the pre-apt and
- post-apt stuff (ie, it needs to commit in the subdirs too). Using
- mr would be a possibility..
+ Another way would be to allow splitting out subdirs into their own repos.
+ This is already doable, would just need modifying the pre-install and
+ post-instlal stuff (ie, it needs to commit in the subdirs too). Using mr
+ would be a possibility..
+
+* Figure out what packages were acted on, and include that info in the commit
+ message
diff --git a/apt.conf b/apt.conf
index 4293637..97d0f87 100644
--- a/apt.conf
+++ b/apt.conf
@@ -1,2 +1,2 @@
-DPkg::Pre-Install-Pkgs { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-apt; fi"; };
-DPkg::Post-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-apt; fi"; };
+DPkg::Pre-Install-Pkgs { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; };
+DPkg::Post-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };
diff --git a/bash_completion b/bash_completion
new file mode 100644
index 0000000..372b76b
--- /dev/null
+++ b/bash_completion
@@ -0,0 +1,8 @@
+_etckeeper() {
+ local cur;
+ COMPREPLY=();
+ cur=${COMP_WORDS[COMP_CWORD]};
+ COMPREPLY=( $( compgen -W '$(cd /etc/etckeeper/; for i in *.d/; do echo ${i%.d/}; done)' -- $cur ) );
+}
+
+complete -F _etckeeper etckeeper \ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index 718c6c6..87c98dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,18 @@
-etckeeper (0.3) UNRELEASED; urgency=low
+etckeeper (0.7) UNRELEASED; urgency=low
+ [ Joey Hess ]
+ * Added configuration options for highlevel and lowlevel package managers
+ in etckeeper.conf.
+ * Only install apt hooks if apt is used.
+ * Only add backup conffile exclusion to gitignore if dpkg is used.
+ * Rename pre/post-apt.d to pre/post-install.d to allow the same directories
+ to be used for other package managers.
+ * Use the name of the highlevel package manager in commit messages.
+ * Add gnarly conffile renaming code.
+ * Add support for frugalware's pacman-g2 package manager. (Miklos Vajna)
+ * Stop using git-foo commands (Miklos Vajna)
+
+ [ Christian Perrier ]
* Debconf templates and debian/control reviewed by the debian-l10n-
english team as part of the Smith review project. Closes: #454774
* [Debconf translation updates]
@@ -16,6 +29,35 @@ etckeeper (0.3) UNRELEASED; urgency=low
-- Christian Perrier <bubulle@debian.org> Wed, 02 Jan 2008 15:36:33 +0100
+etckeeper (0.6) unstable; urgency=low
+
+ * Depend on a fairly recent git-core. Closes: #453063
+
+ -- Joey Hess <joeyh@debian.org> Sun, 02 Dec 2007 15:46:12 -0500
+
+etckeeper (0.5) unstable; urgency=low
+
+ * Typo. Closes: #452926
+
+ -- Joey Hess <joeyh@debian.org> Mon, 26 Nov 2007 03:16:14 -0500
+
+etckeeper (0.4) unstable; urgency=low
+
+ * Portuguese translation from Américo Monteiro. Closes: #451798
+ * Pass --quiet to git-rm calls.
+
+ -- Joey Hess <joeyh@debian.org> Tue, 20 Nov 2007 01:04:32 -0500
+
+etckeeper (0.3) unstable; urgency=low
+
+ * Patch from Remi Vanicat adding an etckeeper.conf file and
+ a GIT_COMMIT_OPTIONS configuration setting. Closes: #451167
+ * Add network/run and adjtime to default gitignore. Closes: #451347
+ * Patch from Rémi Vanicat adding bash completion. Closes: #451302
+ * Remove redundant dependency on debconf. Closes: #451378
+
+ -- Joey Hess <joeyh@debian.org> Thu, 15 Nov 2007 12:21:02 -0500
+
etckeeper (0.2) unstable; urgency=low
* Add .pwd.lock to default ignores, this file is created by programs
diff --git a/debian/control b/debian/control
index e908d28..708f929 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Homepage: http://kitenet.net/~joey/code/etckeeper/
Package: etckeeper
Architecture: all
Section: admin
-Depends: metastore, git-core, ${misc:Depends}, debconf | debconf-2.0
+Depends: metastore, git-core (>= 1:1.5.3.4), ${misc:Depends}
Description: store /etc in git
The etckeeper program is a tool to let /etc be stored in a git
repository. It hooks into APT to automatically commit changes made to /etc
diff --git a/debian/postinst b/debian/postinst
index be4bf1f..33891dd 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,3 +5,33 @@ set -e
. /usr/share/debconf/confmodule
#DEBHELPER#
+
+# Move a conffile without triggering a dpkg question
+mv_conffile() {
+ OLDCONFFILE="$1"
+ NEWCONFFILE="$2"
+
+ if [ -e "$OLDCONFFILE" ]; then
+ echo "Preserving user changes to $NEWCONFFILE ..."
+ mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
+ mv -f "$OLDCONFFILE" "$NEWCONFFILE"
+ fi
+}
+
+case "$1" in
+configure)
+ if dpkg --compare-versions "$2" le "0.7"; then
+ if [ -d /etc/etckeeper/pre-apt.d ]; then
+ for c in README 50uncommitted-changes; do
+ mv_conffile "/etc/etckeeper/pre-apt.d/$c" "/etc/etckeeper/pre-install.d/$c"
+ done
+ rmdir --ignore-fail-on-non-empty /etc/etckeeper/pre-apt.d
+ fi
+ if [ -d /etc/etckeeper/post-apt.d ]; then
+ for c in README 10git-test 30git-add 40git-rm 50git-commit; do
+ mv_conffile "/etc/etckeeper/post-apt.d/$c" "/etc/etckeeper/post-install.d/$c"
+ done
+ rmdir --ignore-fail-on-non-empty /etc/etckeeper/post-apt.d
+ fi
+ fi
+esac
diff --git a/debian/preinst b/debian/preinst
new file mode 100644
index 0000000..f4a086f
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+# Prepare to move a conffile without triggering a dpkg question
+prep_mv_conffile() {
+ CONFFILE="$1"
+
+ if [ -e "$CONFFILE" ]; then
+ md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+ old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
+ if [ "$md5sum" = "$old_md5sum" ]; then
+ rm -f "$CONFFILE"
+ fi
+ fi
+}
+
+case "$1" in
+install|upgrade)
+ if dpkg --compare-versions "$2" le "0.7"; then
+ for c in README 50uncommitted-changes; do
+ prep_mv_conffile "/etc/etckeeper/pre-apt.d/$c"
+ done
+ for c in README 10git-test 30git-add 40git-rm 50git-commit; do
+ prep_mv_conffile "/etc/etckeeper/post-apt.d/$c"
+ done
+ fi
+esac
diff --git a/etckeeper b/etckeeper
index 363f706..f78afdf 100755
--- a/etckeeper
+++ b/etckeeper
@@ -1,6 +1,20 @@
#!/bin/sh
set -e
+if [ -e /etc/etckeeper/etckeeper.conf ]; then
+ . /etc/etckeeper/etckeeper.conf
+fi
+
+if [ ! -z "$GIT_COMMIT_OPTIONS" ]; then
+ export GIT_COMMIT_OPTIONS
+fi
+if [ ! -z "$HIGHLEVEL_PACKAGE_MANAGER" ]; then
+ export HIGHLEVEL_PACKAGE_MANAGER
+fi
+if [ ! -z "$LOWLEVEL_PACKAGE_MANAGER" ]; then
+ export LOWLEVEL_PACKAGE_MANAGER
+fi
+
if [ -z "$1" ]; then
echo "usage: etckeeper command [directory]" >&2
exit 1
diff --git a/etckeeper.1 b/etckeeper.1
index 2d38bf8..6d00cdb 100644
--- a/etckeeper.1
+++ b/etckeeper.1
@@ -21,13 +21,14 @@ a clone of the /etc repository located elsewhere.
This is called as a git pre-commit hook. It stores metadata and does sanity
checks.
.TP
-.B pre-apt
-This is called by apt's DPkg::Pre-Install-Pkgs hook. It allows committing
-any uncommitted changes before the apt run.
+.B pre-install
+This is called by apt's DPkg::Pre-Install-Pkgs hook, or by equivilant hooks
+of other package managers. It allows committing any uncommitted changes before
+packages are installed, upgraded, etc.
.TP
-.B post-apt
-This is called by apt's DPkg::Post-Invoke hook. It commits changes made by
-packages into the repository. (You can also call this by hand after running
-dpkg by hand.)
+.B post-install
+This is called by apt's DPkg::Post-Invoke hook, or by equivilant hooks
+of other package managers. It commits changes made by packages into the
+repository. (You can also call this by hand after running dpkg by hand.)
.SH AUTHOR
Joey Hess, <joey@kitenet.net>.
diff --git a/etckeeper.conf b/etckeeper.conf
new file mode 100644
index 0000000..d56f866
--- /dev/null
+++ b/etckeeper.conf
@@ -0,0 +1,10 @@
+# Options passed to git commit when run by etckeeper.
+# You could for exemple use "-e" if you want to edit all commit messages
+# before committing.
+#GIT_COMMIT_OPTIONS="-e"
+
+# The high-level package manager that's being used.
+HIGHLEVEL_PACKAGE_MANAGER=apt
+
+# The low-level package manager that's being used.
+LOWLEVEL_PACKAGE_MANAGER=dpkg
diff --git a/init.d/40git-init b/init.d/40git-init
index 69867c4..1554166 100755
--- a/init.d/40git-init
+++ b/init.d/40git-init
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
if [ ! -e .git ]; then
- git-init
+ git init
echo "$(hostname) /etc repository" > .git/description
fi
diff --git a/init.d/50git-ignore b/init.d/50git-ignore
index 16754a4..71469ab 100755
--- a/init.d/50git-ignore
+++ b/init.d/50git-ignore
@@ -1,11 +1,23 @@
#!/bin/sh
set -e
if [ ! -e .gitignore ]; then
- cat >.gitignore <<EOF
-*~
-
+ if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
+ cat >.gitignore <<EOF
# new and old versions of conffiles, stored by dpkg
*.dpkg-*
+EOF
+ fi
+ if [ "$LOWLEVEL_PACKAGE_MANAGER" = "pacman-g2" ]; then
+ cat >.gitignore <<EOF
+# new and old versions of conffiles, stored by pacman
+*.pacnew
+*.pacorig
+*.pacsave
+EOF
+ fi
+ cat >>.gitignore <<EOF
+
+*~
# mount(8) records system state here, no need to keep these in git
blkid.tab
@@ -15,6 +27,8 @@ blkid.tab.old
ld.so.cache
mtab
.pwd.lock
+network/run
+adjtime
EOF
fi
diff --git a/init.d/70git-add b/init.d/70git-add
index 06504b4..1e2680c 100755
--- a/init.d/70git-add
+++ b/init.d/70git-add
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
-if ! git-add .; then
- echo "etckeeper warning: git-add failed" >&2
+if ! git add .; then
+ echo "etckeeper warning: git add failed" >&2
fi
diff --git a/pacman-g2.hook b/pacman-g2.hook
new file mode 100644
index 0000000..bed39f0
--- /dev/null
+++ b/pacman-g2.hook
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+pre_sysupgrade() {
+ if [ -x /usr/bin/etckeeper ]; then
+ etckeeper pre-apt
+ fi
+}
+
+post_sysupgrade() {
+ if [ -x /usr/bin/etckeeper ]; then
+ etckeeper post-apt
+ fi
+}
+
+op=$1
+shift
+$op $*
diff --git a/post-apt.d/30git-add b/post-apt.d/30git-add
deleted file mode 100755
index 79aa406..0000000
--- a/post-apt.d/30git-add
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-set -e
-if [ -d .git ]; then
- if ! git-add .; then
- echo "etckeeper warning: git-add failed" >&2
- fi
-fi
diff --git a/post-apt.d/50git-commit b/post-apt.d/50git-commit
deleted file mode 100755
index 6eb3434..0000000
--- a/post-apt.d/50git-commit
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -d .git ]; then
-
- # TODO: figure out what packages were acted on by the apt run, and
- # include that info in the commit message
- message="committing changes after apt run"
-
- # ignore exit code since it exits nonzero if there is nothing to do
- git commit -m "$message" || true
-fi
diff --git a/post-apt.d/README b/post-apt.d/README
deleted file mode 100644
index befa5c0..0000000
--- a/post-apt.d/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Files in this directory are run after apt has run. They should commit
-changes and new files in /etc to repository.
diff --git a/post-install.d/10git-test b/post-install.d/10git-test
new file mode 100755
index 0000000..e72f195
--- /dev/null
+++ b/post-install.d/10git-test
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if [ ! -d .git ]; then
+ echo "etckeeper warning: etckeeper is not yet enabled for $(pwd)" >&2
+ echo "etckeeper warning: run etckeeper init to enable it" >&2
+fi
diff --git a/post-install.d/30git-add b/post-install.d/30git-add
new file mode 100755
index 0000000..33858a7
--- /dev/null
+++ b/post-install.d/30git-add
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+if [ -d .git ]; then
+ if ! git add .; then
+ echo "etckeeper warning: git add failed" >&2
+ fi
+fi
diff --git a/post-apt.d/40git-rm b/post-install.d/40git-rm
index 01161ca..680dac0 100755
--- a/post-apt.d/40git-rm
+++ b/post-install.d/40git-rm
@@ -6,7 +6,7 @@ TAB=" "
if [ -d .git ]; then
for file in $(git ls-files --deleted); do
if [ ! -d "$file" ]; then
- git rm "$file"
+ git rm --quiet "$file"
fi
done
fi
diff --git a/post-install.d/50git-commit b/post-install.d/50git-commit
new file mode 100755
index 0000000..78247ca
--- /dev/null
+++ b/post-install.d/50git-commit
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+if [ -d .git ]; then
+ message="committing changes after $HIGHLEVEL_PACKAGE_MANAGER run"
+
+ # ignore exit code since it exits nonzero if there is nothing to do
+ git commit $GIT_COMMIT_OPTIONS -m "$message" || true
+fi
diff --git a/post-install.d/README b/post-install.d/README
new file mode 100644
index 0000000..62f4f9c
--- /dev/null
+++ b/post-install.d/README
@@ -0,0 +1,2 @@
+Files in this directory are run after packages are installed, upgraded, etc.
+They should commit changes and new files in /etc to repository.
diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes
deleted file mode 100755
index dd8db13..0000000
--- a/pre-apt.d/50uncommitted-changes
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-set -e
-if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
- . /usr/share/debconf/confmodule
- db_capb escape
- db_title etckeeper
-
- db_reset etckeeper/unclean || true
- db_subst etckeeper/unclean STATUS $(git-status | debconf-escape -e) || true
- db_input critical etckeeper/unclean || true
- db_go || true
- db_get etckeeper/unclean
- if [ "$RET" = true ]; then
- git add .
- if ! git commit -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
diff --git a/pre-apt.d/README b/pre-apt.d/README
deleted file mode 100644
index 47001b4..0000000
--- a/pre-apt.d/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Files in this directory are run before apt is run. This is mostly used for
-sanity checks, ie, does /etc have any uncommitted changes?
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
new file mode 100755
index 0000000..1af33d4
--- /dev/null
+++ b/pre-install.d/50uncommitted-changes
@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e
+
+if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
+ RET="true"
+ if [ -e /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+ db_capb escape
+ db_title etckeeper
+
+ db_reset etckeeper/unclean || true
+ db_subst etckeeper/unclean STATUS $(git status | debconf-escape -e) || true
+ db_input critical etckeeper/unclean || true
+ db_go || true
+ db_get etckeeper/unclean
+ fi
+ if [ "$RET" = true ]; then
+ git add .
+ if ! git commit $GIT_COMMIT_OPTIONS -m "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
+ if [ -e /usr/share/debconf/confmodule ]; then
+ db_input critical etckeeper/commit_failed || true
+ db_go || true
+ db_reset etckeeper/commit_failed || true
+ else
+ echo "error: etckeeper failed to commit changes in /etc using git (git commit failed)"
+ exit 1
+ fi
+ fi
+ fi
+ if [ -e /usr/share/debconf/confmodule ]; then
+ db_reset etckeeper/unclean || true
+ fi
+fi
diff --git a/pre-install.d/README b/pre-install.d/README
new file mode 100644
index 0000000..a3b5a57
--- /dev/null
+++ b/pre-install.d/README
@@ -0,0 +1,3 @@
+Files in this directory are run before packages are installed, upgraded,
+etc. This is mostly used for sanity checks, ie, does /etc have any
+uncommitted changes?