diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-15 14:21:46 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-15 14:21:46 -0500 |
commit | c8f16796c6c72251814626ccf911d8f025cc60f3 (patch) | |
tree | 17c99c0cc0570d2167ceb3cf888d60df304a757a /commit.d | |
parent | 45fa1c5a4d911503b545df62c4e276807063dc4e (diff) |
* Convert the directory parameter of etckeeper into "-d directory".
* Pass other patameters on from etckeeper to the .d scripts.
* Stop using run-parts for various reasons.
* Split out a commit.d that contains committing code that's used by
both the pre-install.d and post-install.d scripts.
* Split out an unclean.d that tests if the WC contains uncommitted
changes.
* Add preinst code to remove old post-install.d scripts.
Diffstat (limited to 'commit.d')
-rwxr-xr-x | commit.d/10vcs-test | 13 | ||||
-rwxr-xr-x | commit.d/30git-add | 8 | ||||
-rwxr-xr-x | commit.d/30hg-addremove | 8 | ||||
-rwxr-xr-x | commit.d/40git-rm | 12 | ||||
-rwxr-xr-x | commit.d/50vcs-commit | 18 | ||||
-rw-r--r-- | commit.d/README | 3 |
6 files changed, 62 insertions, 0 deletions
diff --git a/commit.d/10vcs-test b/commit.d/10vcs-test new file mode 100755 index 0000000..ddd4448 --- /dev/null +++ b/commit.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/commit.d/30git-add b/commit.d/30git-add new file mode 100755 index 0000000..66d96a9 --- /dev/null +++ b/commit.d/30git-add @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ "$VCS" = git ] && [ -d .git ]; then + if ! git add .; then + echo "etckeeper warning: git add failed" >&2 + fi +fi diff --git a/commit.d/30hg-addremove b/commit.d/30hg-addremove new file mode 100755 index 0000000..1b999bb --- /dev/null +++ b/commit.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/commit.d/40git-rm b/commit.d/40git-rm new file mode 100755 index 0000000..3d5289a --- /dev/null +++ b/commit.d/40git-rm @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +TAB=" " + +if [ "$VCS" = git ] && [ -d .git ]; then + for file in $(git ls-files --deleted); do + if [ ! -d "$file" ]; then + git rm --quiet "$file" + fi + done +fi diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit new file mode 100755 index 0000000..48fa177 --- /dev/null +++ b/commit.d/50vcs-commit @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +message="$1" + +if [ "$VCS" = git ] && [ -d .git ]; then + if [ -n "$message" ]; then + git commit $GIT_COMMIT_OPTIONS -m "$message" + else + git commit $GIT_COMMIT_OPTIONS + fi +elif [ "$VCS" = hg ] && [ -d .hg ]; then + if [ -n "$message" ]; then + hg commit $HG_COMMIT_OPTIONS -m "$message" + else + hg commit $HG_COMMIT_OPTIONS + fi +fi diff --git a/commit.d/README b/commit.d/README new file mode 100644 index 0000000..25d0d45 --- /dev/null +++ b/commit.d/README @@ -0,0 +1,3 @@ +Files in this directory are run when there might be changes to commit. +(Before and after packages are installed, upgraded, etc.) +They should commit changes and new files in /etc to repository. |