summaryrefslogtreecommitdiff
path: root/post-install.d
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 /post-install.d
parent69739dd0341ba72a645344ea14658f0ede006079 (diff)
parentfd4a85189390d6e6f022eb8f71fcecb5d5f82958 (diff)
Merge branch 'hg'
Significantly refactored
Diffstat (limited to 'post-install.d')
-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
7 files changed, 35 insertions, 17 deletions
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