summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-13 19:09:10 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-13 19:09:10 -0500
commit26a46bf2fd473122e53a3303226b093523d30bfd (patch)
tree12f7d4cd0594b371ac35f3bcf0ad4dd1a104ae8d
parent8824d34847c9ebe106c9e362b2d1af1b031217dc (diff)
* Add tests for /etc/.git not yet existing and avoid doing bad things.
Closes: #451185 * If /etc/.git doesn't exist, display a suggestion to run etckeeper-init.
-rw-r--r--debian/changelog5
-rwxr-xr-xpost-apt.d/30git-add6
-rwxr-xr-xpost-apt.d/40git-rm12
-rwxr-xr-xpost-apt.d/50git-commit13
-rwxr-xr-xpre-apt.d/50uncommitted-changes2
5 files changed, 24 insertions, 14 deletions
diff --git a/debian/changelog b/debian/changelog
index 22289d8..3a923b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,11 @@ etckeeper (0.2) UNRELEASED; urgency=low
* Add .pwd.lock to default ignores, this file is created by programs
that call getspent().
+ * Add tests for /etc/.git not yet existing and avoid doing bad things.
+ Closes: #451185
+ * If /etc/.git doesn't exist, display a suggestion to run etckeeper-init.
- -- Joey Hess <joeyh@debian.org> Sun, 11 Nov 2007 14:41:40 -0500
+ -- Joey Hess <joeyh@debian.org> Tue, 13 Nov 2007 19:07:14 -0500
etckeeper (0.1) unstable; urgency=low
diff --git a/post-apt.d/30git-add b/post-apt.d/30git-add
index 06504b4..79aa406 100755
--- a/post-apt.d/30git-add
+++ b/post-apt.d/30git-add
@@ -1,5 +1,7 @@
#!/bin/sh
set -e
-if ! git-add .; then
- echo "etckeeper warning: git-add failed" >&2
+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-apt.d/40git-rm
index 4a47435..01161ca 100755
--- a/post-apt.d/40git-rm
+++ b/post-apt.d/40git-rm
@@ -3,8 +3,10 @@ set -e
TAB=" "
-for file in $(git ls-files --deleted); do
- if [ ! -d "$file" ]; then
- git rm "$file"
- fi
-done
+if [ -d .git ]; then
+ for file in $(git ls-files --deleted); do
+ if [ ! -d "$file" ]; then
+ git rm "$file"
+ fi
+ done
+fi
diff --git a/post-apt.d/50git-commit b/post-apt.d/50git-commit
index 30ef0f2..6eb3434 100755
--- a/post-apt.d/50git-commit
+++ b/post-apt.d/50git-commit
@@ -1,9 +1,12 @@
#!/bin/sh
set -e
-# 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"
+if [ -d .git ]; then
-# ignore exit code since it exits nonzero if there is nothing to do
-git commit -m "$message" || true
+ # 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/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes
index e394db1..dd8db13 100755
--- a/pre-apt.d/50uncommitted-changes
+++ b/pre-apt.d/50uncommitted-changes
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
-if ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
+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