summaryrefslogtreecommitdiff
path: root/post-install.d
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:12:05 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:12:05 -0500
commitef70e3d7e62671d0cadb2731e6965768f73ca290 (patch)
treee0470bd941f4d9f39068499265731e9e53818657 /post-install.d
parent3021117f7b4e17041d96e4906fce90a1ccd0183e (diff)
* 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.
Diffstat (limited to 'post-install.d')
-rwxr-xr-xpost-install.d/10git-test6
-rwxr-xr-xpost-install.d/30git-add7
-rwxr-xr-xpost-install.d/40git-rm12
-rwxr-xr-xpost-install.d/50git-commit9
-rw-r--r--post-install.d/README2
5 files changed, 36 insertions, 0 deletions
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..79aa406
--- /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-install.d/40git-rm b/post-install.d/40git-rm
new file mode 100755
index 0000000..680dac0
--- /dev/null
+++ b/post-install.d/40git-rm
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+TAB=" "
+
+if [ -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/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.