summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-04 17:38:10 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-04 17:38:10 -0500
commit788ae5a34c0fad2e3c0788a745400a138d735195 (patch)
tree2517eb3ccf206f4ed7b6ef6a1d543c87caaf2e41
parent69739dd0341ba72a645344ea14658f0ede006079 (diff)
parentfd4a85189390d6e6f022eb8f71fcecb5d5f82958 (diff)
Merge branch 'hg'
Significantly refactored
-rw-r--r--Makefile26
-rw-r--r--bash_completion2
-rwxr-xr-xetckeeper15
-rw-r--r--etckeeper.conf7
-rwxr-xr-xinit.d/40git-init6
-rwxr-xr-xinit.d/40vcs-init11
-rwxr-xr-xinit.d/50git-ignore34
-rwxr-xr-xinit.d/50git-perm3
-rwxr-xr-xinit.d/50git-pre-commit-hook15
-rwxr-xr-xinit.d/50vcs-ignore70
-rwxr-xr-xinit.d/50vcs-perm8
-rwxr-xr-xinit.d/50vcs-pre-commit-hook32
-rwxr-xr-xinit.d/70git-add5
-rwxr-xr-xinit.d/70vcs-add12
-rwxr-xr-xpost-install.d/10git-test6
-rwxr-xr-xpost-install.d/10vcs-test13
-rwxr-xr-xpost-install.d/30git-add3
-rwxr-xr-xpost-install.d/30hg-addremove8
-rwxr-xr-xpost-install.d/40git-rm2
-rwxr-xr-xpost-install.d/50git-commit9
-rwxr-xr-xpost-install.d/50vcs-commit11
-rwxr-xr-xpre-commit.d/20store-empty-directory34
-rwxr-xr-xpre-commit.d/20warn-hardlinks11
-rwxr-xr-xpre-commit.d/20warn-special-file11
-rwxr-xr-xpre-commit.d/30store-metadata31
-rwxr-xr-xpre-install.d/50uncommitted-changes37
26 files changed, 293 insertions, 129 deletions
diff --git a/Makefile b/Makefile
index a96bb1b..a497a9a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,16 +3,26 @@
CONFFILE=etckeeper.conf
include $(CONFFILE)
+DESTDIR?=
+prefix=/usr
+bindir=${prefix}/bin
+etcdir=/etc
+mandir=${prefix}/share/man
+
+INSTALL=install
+INSTALL_EXE=${INSTALL} -D
+INSTALL_DATA=${INSTALL} -m 0644 -D
+
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 etckeeper.1 $(PREFIX)/usr/share/man/man1/etckeeper.1
- install -m 0644 -D bash_completion $(PREFIX)/etc/bash_completion.d/etckeeper
+ mkdir -p $(DESTDIR)$(etcdir)/etckeeper/
+ cp -a *.d $(DESTDIR)$(etcdir)/etckeeper/
+ $(INSTALL_DATA) $(CONFFILE) $(DESTDIR)$(etcdir)/etckeeper/etckeeper.conf
+ $(INSTALL_EXE) etckeeper $(DESTDIR)$(bindir)/etckeeper
+ $(INSTALL_DATA) etckeeper.1 $(DESTDIR)$(mandir)/man1/etckeeper.1
+ $(INSTALL_DATA) bash_completion $(DESTDIR)$(etcdir)/bash_completion.d/etckeeper
ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),apt))
- install -m 0644 -D apt.conf $(PREFIX)/etc/apt/apt.conf.d/05etckeeper
+ $(INSTALL_DATA) apt.conf $(DESTDIR)$(etcdir)/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
+ $(INSTALL_DATA) pacman-g2.hook $(DESTDIR)$(etcdir)/etc/pacman-g2/hooks/etckeeper
endif
diff --git a/bash_completion b/bash_completion
index 372b76b..b1a3d31 100644
--- a/bash_completion
+++ b/bash_completion
@@ -5,4 +5,4 @@ _etckeeper() {
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
+complete -F _etckeeper etckeeper
diff --git a/etckeeper b/etckeeper
index f78afdf..e2073ec 100755
--- a/etckeeper
+++ b/etckeeper
@@ -1,13 +1,24 @@
#!/bin/sh
set -e
+conf=/etc/etckeeper/etckeeper.conf
-if [ -e /etc/etckeeper/etckeeper.conf ]; then
- . /etc/etckeeper/etckeeper.conf
+if [ -e $conf ]; then
+ . $conf
fi
+if [ -z "$VCS" ]; then
+ echo "Please configure a VCS in $conf" >&2
+ exit 1
+fi
+export VCS
+
if [ ! -z "$GIT_COMMIT_OPTIONS" ]; then
export GIT_COMMIT_OPTIONS
fi
+if [ ! -z "$HG_COMMIT_OPTIONS" ]; then
+ export HG_COMMIT_OPTIONS
+fi
+
if [ ! -z "$HIGHLEVEL_PACKAGE_MANAGER" ]; then
export HIGHLEVEL_PACKAGE_MANAGER
fi
diff --git a/etckeeper.conf b/etckeeper.conf
index d56f866..4cf5f58 100644
--- a/etckeeper.conf
+++ b/etckeeper.conf
@@ -1,8 +1,15 @@
+# The VCS to use.
+# VCS="hg"
+VCS="git"
+
# 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"
+# Options passed to hg commit when run by etckeeper.
+#HG_COMMIT_OPTIONS=""
+
# The high-level package manager that's being used.
HIGHLEVEL_PACKAGE_MANAGER=apt
diff --git a/init.d/40git-init b/init.d/40git-init
deleted file mode 100755
index 1554166..0000000
--- a/init.d/40git-init
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-set -e
-if [ ! -e .git ]; then
- git init
- echo "$(hostname) /etc repository" > .git/description
-fi
diff --git a/init.d/40vcs-init b/init.d/40vcs-init
new file mode 100755
index 0000000..e2677bc
--- /dev/null
+++ b/init.d/40vcs-init
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = git ] && [ ! -e .git ]; then
+ git init
+ echo "$(hostname) /etc repository" > .git/description
+elif [ "$VCS" = hg ] && [ ! -e .hg ]; then
+ hg init
+ echo "[web]" > .hg/hgrc
+ echo "description = $(hostname) /etc repository" >> .hg/hgrc
+fi
diff --git a/init.d/50git-ignore b/init.d/50git-ignore
deleted file mode 100755
index 71469ab..0000000
--- a/init.d/50git-ignore
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-set -e
-if [ ! -e .gitignore ]; then
- 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
-blkid.tab.old
-
-# some other files in /etc that typically do not need to be tracked
-ld.so.cache
-mtab
-.pwd.lock
-network/run
-adjtime
-
-EOF
-fi
diff --git a/init.d/50git-perm b/init.d/50git-perm
deleted file mode 100755
index 564e489..0000000
--- a/init.d/50git-perm
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-set -e
-chmod 700 .git
diff --git a/init.d/50git-pre-commit-hook b/init.d/50git-pre-commit-hook
deleted file mode 100755
index 0efd5e4..0000000
--- a/init.d/50git-pre-commit-hook
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-set -e
-if [ -x .git/hooks/pre-commit ]; then
- if ! grep -q "etckeeper pre-commit" .git/hooks/pre-commit; then
- echo "etckeeper warning: .git/hooks/pre-commit needs to be manually modifed to run: etckeeper pre-commit `pwd`" >&2
- fi
-else
- cat >.git/hooks/pre-commit <<EOF
-#!/bin/sh
-# pre-commit hook for etckeeper, to store metadata and do sanity checks
-set -e
-etckeeper pre-commit `pwd`
-EOF
- chmod +x .git/hooks/pre-commit
-fi
diff --git a/init.d/50vcs-ignore b/init.d/50vcs-ignore
new file mode 100755
index 0000000..18f368e
--- /dev/null
+++ b/init.d/50vcs-ignore
@@ -0,0 +1,70 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = git ] && [ ! -e .gitignore ]; then
+ file=.gitignore
+elif [ "$VCS" = hg ] && [ ! -e .hgignore ]; then
+ file=.hgignore
+fi
+
+if [ -z "$file" ] || [ -e "$file" ]; then
+ exit 0
+fi
+
+nl() {
+ echo >>$file
+}
+
+comment() {
+ comment="$1"
+ echo "# $comment" >>$file
+}
+
+ignore() {
+ glob="$1"
+
+ case "$VCS" in
+ git)
+ echo "$glob" >> $file
+ ;;
+ hg)
+ # rather than converting the glob to a regexp, just
+ # configure hg to use globs
+ if [ -z "$hg_syntax_printed" ]; then
+ comment "use glob syntax"
+ echo "syntax: glob" >> $file
+ nl
+ hg_syntax_printed=1
+ fi
+ echo "$glob" >> $file
+ ;;
+ esac
+}
+
+if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
+ comment "new and old versions of conffiles, stored by dpkg"
+ ignore "*.dpkg-*"
+ nl
+elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "pacman-g2" ]; then
+ comment "new and old versions of conffiles, stored by pacman"
+ ignore "*.pacnew"
+ ignore "*.pacorig"
+ ignore "*.pacsave"
+ nl
+fi
+
+ignore "*~"
+nl
+
+comment "mount(8) records system state here, no need to store these"
+ignore blkid.tab
+ignore blkid.tab.old
+nl
+
+comment "some other files in /etc that typically do not need to be tracked"
+ignore ld.so.cache
+ignore mtab
+ignore .pwd.lock
+ignore network/run
+ignore adjtime
+nl
diff --git a/init.d/50vcs-perm b/init.d/50vcs-perm
new file mode 100755
index 0000000..9ffad92
--- /dev/null
+++ b/init.d/50vcs-perm
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = git ]; then
+ chmod 700 .git
+elif [ "$VCS" = hg ]; then
+ chmod 700 .hg
+fi
diff --git a/init.d/50vcs-pre-commit-hook b/init.d/50vcs-pre-commit-hook
new file mode 100755
index 0000000..33d0ae7
--- /dev/null
+++ b/init.d/50vcs-pre-commit-hook
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+case "$VCS" in
+ git)
+ if [ -x .git/hooks/pre-commit ]; then
+ if ! grep -q "etckeeper pre-commit" .git/hooks/pre-commit; then
+ echo "etckeeper warning: .git/hooks/pre-commit needs to be manually modifed to run: etckeeper pre-commit `pwd`" >&2
+ fi
+ else
+ cat >.git/hooks/pre-commit <<EOF
+#!/bin/sh
+# pre-commit hook for etckeeper, to store metadata and do sanity checks
+set -e
+etckeeper pre-commit `pwd`
+EOF
+ chmod +x .git/hooks/pre-commit
+ fi
+ ;;
+ hg)
+ if [ -e .hg/hgrc ] && grep "^\[hooks\]" .hg/hgrc; then
+ echo "etckeeper warning: [hooks] section in .hg/hgrc needs to be manually modified to run: etckeeper pre-commit `pwd`" >&2
+ else
+ touch .hg/hgrc
+ cat >>.hg/hgrc <<EOF
+[hooks]
+# pre-commit hook for etckeeper, to store metadata and do sanity checks
+precommit = etckeeper pre-commit `pwd`
+EOF
+ fi
+ ;;
+esac
diff --git a/init.d/70git-add b/init.d/70git-add
deleted file mode 100755
index 1e2680c..0000000
--- a/init.d/70git-add
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-set -e
-if ! git add .; then
- echo "etckeeper warning: git add failed" >&2
-fi
diff --git a/init.d/70vcs-add b/init.d/70vcs-add
new file mode 100755
index 0000000..8cf60d0
--- /dev/null
+++ b/init.d/70vcs-add
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = git ]; then
+ if ! git add .; then
+ echo "etckeeper warning: git add failed" >&2
+ fi
+elif [ "$VCS" = hg ]; then
+ if ! hg add .; then
+ echo "etckeeper warning: hg add failed" >&2
+ fi
+fi
diff --git a/post-install.d/10git-test b/post-install.d/10git-test
deleted file mode 100755
index e72f195..0000000
--- a/post-install.d/10git-test
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/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/10vcs-test b/post-install.d/10vcs-test
new file mode 100755
index 0000000..ddd4448
--- /dev/null
+++ b/post-install.d/10vcs-test
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+
+not_enabled_warning() {
+ echo "etckeeper warning: etckeeper is not yet enabled for $(pwd)" >&2
+ echo "etckeeper warning: run etckeeper init to enable it" >&2
+}
+
+if [ "$VCS" = git ] && [ ! -d .git ]; then
+ not_enabled_warning
+elif [ "$VCS" = hg ] && [ ! -d .hg ]; then
+ not_enabled_warning
+fi
diff --git a/post-install.d/30git-add b/post-install.d/30git-add
index 33858a7..66d96a9 100755
--- a/post-install.d/30git-add
+++ b/post-install.d/30git-add
@@ -1,6 +1,7 @@
#!/bin/sh
set -e
-if [ -d .git ]; then
+
+if [ "$VCS" = git ] && [ -d .git ]; then
if ! git add .; then
echo "etckeeper warning: git add failed" >&2
fi
diff --git a/post-install.d/30hg-addremove b/post-install.d/30hg-addremove
new file mode 100755
index 0000000..1b999bb
--- /dev/null
+++ b/post-install.d/30hg-addremove
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = hg ] && [ -d .hg ]; then
+ if ! hg addremove .; then
+ echo "etckeeper warning: hg addremove failed" >&2
+ fi
+fi
diff --git a/post-install.d/40git-rm b/post-install.d/40git-rm
index 680dac0..3d5289a 100755
--- a/post-install.d/40git-rm
+++ b/post-install.d/40git-rm
@@ -3,7 +3,7 @@ set -e
TAB=" "
-if [ -d .git ]; then
+if [ "$VCS" = git ] && [ -d .git ]; then
for file in $(git ls-files --deleted); do
if [ ! -d "$file" ]; then
git rm --quiet "$file"
diff --git a/post-install.d/50git-commit b/post-install.d/50git-commit
deleted file mode 100755
index 78247ca..0000000
--- a/post-install.d/50git-commit
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/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/50vcs-commit b/post-install.d/50vcs-commit
new file mode 100755
index 0000000..52c6c10
--- /dev/null
+++ b/post-install.d/50vcs-commit
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+message="committing changes after $HIGHLEVEL_PACKAGE_MANAGER run"
+
+if [ "$VCS" = git ] && [ -d .git ]; then
+ # ignore exit code since it exits nonzero if there is nothing to do
+ git commit $GIT_COMMIT_OPTIONS -m "$message" || true
+elif [ "$VCS" = hg ] && [ -d .hg ]; then
+ hg commit $HG_COMMIT_OPTIONS -m "$message" || true
+fi
diff --git a/pre-commit.d/20store-empty-directory b/pre-commit.d/20store-empty-directory
index e0f9538..0cab9df 100755
--- a/pre-commit.d/20store-empty-directory
+++ b/pre-commit.d/20store-empty-directory
@@ -1,19 +1,27 @@
#!/bin/sh
set -e
-# Make sure the file is not readable by others, since it can leak
-# information about contents of non-readable directories in /etc.
-umask 077
+# These version control systems do not track directories, so empty
+# directories must be stored specially.
+if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
+ # Make sure the file is not readable by others, since it can leak
+ # information about contents of non-readable directories in /etc.
+ umask 077
-if [ -e .etckeeper ]; then
- egrep -v '^mkdir ' .etckeeper > .etckeeper.new || true
-fi
-find -type d -empty | grep -v /.git/ | sort |
- sed -e "s/^/mkdir -p '/" -e "s/\$/'/" >> .etckeeper.new
+ if [ -e .etckeeper ]; then
+ egrep -v '^mkdir ' .etckeeper > .etckeeper.new || true
+ fi
+ find -type d -empty | grep -v /.git/ | grep -v /.hg/ | sort |
+ sed -e "s/^/mkdir -p '/" -e "s/\$/'/" >> .etckeeper.new
-if [ ! -e .etckeeper ] || ! cmp -s .etckeeper .etckeeper.new ; then
- mv -f .etckeeper.new .etckeeper
- git add .etckeeper
-else
- rm -f .etckeeper.new
+ if [ ! -e .etckeeper ] || ! cmp -s .etckeeper .etckeeper.new ; then
+ mv -f .etckeeper.new .etckeeper
+ if [ "$VCS" = git ]; then
+ git add .etckeeper
+ elif [ "$VCS" = hg ]; then
+ hg add .etckeeper
+ fi
+ else
+ rm -f .etckeeper.new
+ fi
fi
diff --git a/pre-commit.d/20warn-hardlinks b/pre-commit.d/20warn-hardlinks
index 3dd7a96..8716dbd 100755
--- a/pre-commit.d/20warn-hardlinks
+++ b/pre-commit.d/20warn-hardlinks
@@ -1,7 +1,10 @@
#!/bin/sh
set -e
-hardlinks=$(find -type f -not -links 1 | grep -v /.git/) || true
-if [ -n "$hardlinks" ]; then
- echo "etckeeper warning: hardlinked files could cause problems with git:" >&2
- echo "$hardlinks" >&2
+
+if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
+ hardlinks=$(find -type f -not -links 1 | grep -v /.git/) || true
+ if [ -n "$hardlinks" ]; then
+ echo "etckeeper warning: hardlinked files could cause problems with $VCS:" >&2
+ echo "$hardlinks" >&2
+ fi
fi
diff --git a/pre-commit.d/20warn-special-file b/pre-commit.d/20warn-special-file
index cb4d019..42e812b 100755
--- a/pre-commit.d/20warn-special-file
+++ b/pre-commit.d/20warn-special-file
@@ -1,9 +1,12 @@
#!/bin/sh
set -e
-special=$(find -not -type d -not -type f -not -type l | grep -v /.git/) || true
-if [ -n "$special" ]; then
- echo "etckeeper warning: special files could cause problems with git:" >&2
- echo "$special" >&2
+
+if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
+ special=$(find -not -type d -not -type f -not -type l | grep -v /.git/) || true
+ if [ -n "$special" ]; then
+ echo "etckeeper warning: special files could cause problems with $VCS:" >&2
+ echo "$special" >&2
+ fi
fi
true
diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata
index b878abd..959e714 100755
--- a/pre-commit.d/30store-metadata
+++ b/pre-commit.d/30store-metadata
@@ -1,18 +1,25 @@
#!/bin/sh
set -e
-# Make sure the file is not readable by others, since it can leak
-# information about contents of non-readable directories in /etc.
-umask 077
+if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
+ # Make sure the file is not readable by others, since it can leak
+ # information about contents of non-readable directories in /etc.
+ umask 077
-# ensure the file exists so that it will list its own metadata
-if [ ! -e .metadata ]; then
- metastore --save
-fi
+ # ensure the file exists so that it will list its own metadata
+ if [ ! -e .metadata ]; then
+ metastore --save
+ fi
+
+ # metastore doesn't produce the same output file for the same metadata
+ # everytime, so avoid changing the file if nothing really changed.
+ if [ ! -z "$(metastore --compare)" ]; then
+ metastore --save
-# metastore doesn't produce the same output file for the same metadata
-# everytime, so avoid changing the file if nothing really changed.
-if [ ! -z "$(metastore --compare)" ]; then
- metastore --save
- git add .metadata
+ if [ "$VCS" = git ]; then
+ git add .metadata
+ elif [ "$VCS" = hg ]; then
+ hg add .metadata
+ fi
+ fi
fi
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
index 1af33d4..30a6fd7 100755
--- a/pre-install.d/50uncommitted-changes
+++ b/pre-install.d/50uncommitted-changes
@@ -1,7 +1,35 @@
#!/bin/sh
set -e
-if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
+unclean() {
+ if [ "$VCS" = git ]; then
+ [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"
+ elif [ "$VCS" = hg ]; then
+ [ -d .hg ] && ! hg status 2>&1 | wc -l | grep -q "^0$"
+ fi
+}
+
+status() {
+ if [ "$VCS" = git ]; then
+ git status
+ elif [ "$VCS" = hg ]; then
+ hg status
+ fi
+}
+
+commit() {
+ message="$1"
+
+ if [ "$VCS" = git ]; then
+ git add .
+ git commit $GIT_COMMIT_OPTIONS -m "$message"
+ elif [ "$VCS" = hg ]; then
+ hg addremove .
+ hg commit $HG_COMMIT_OPTIONS -m "$message"
+ fi
+}
+
+if unclean; then
RET="true"
if [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
@@ -9,20 +37,19 @@ if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean";
db_title etckeeper
db_reset etckeeper/unclean || true
- db_subst etckeeper/unclean STATUS $(git status | debconf-escape -e) || true
+ db_subst etckeeper/unclean STATUS $(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 ! commit "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)"
+ echo "error: etckeeper failed to commit changes in /etc using $VCS"
exit 1
fi
fi