summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-01-04 01:24:19 +0100
committerJoey Hess <joey@kodama.kitenet.net>2008-01-03 20:03:32 -0500
commit4c3f828ef59889783c84b360f95d90ab37bc2511 (patch)
tree0943276d2ce0b1ffaa754f59b2638a43fbfd266b
parent3021117f7b4e17041d96e4906fce90a1ccd0183e (diff)
Add support for the pacman-g2 package manager.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
-rw-r--r--Makefile5
-rwxr-xr-xinit.d/50git-ignore5
-rw-r--r--pacman-g2.hook19
-rwxr-xr-xpre-apt.d/50uncommitted-changes31
4 files changed, 48 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 17ac854..3ad9a18 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@ install:
cp -a *.d $(PREFIX)/etc/etckeeper/
cp etckeeper.conf $(PREFIX)/etc/etckeeper/
install -D etckeeper $(PREFIX)/usr/bin/etckeeper
+ifeq ($(PACKAGE_MANAGER),)
install -m 0644 -D apt.conf $(PREFIX)/etc/apt/apt.conf.d/05etckeeper
+endif
+ifeq ($(PACKAGE_MANAGER),pacman-g2)
+ install -m 0644 -D pacman-g2.hook $(PREFIX)/etc/pacman-g2/hooks/etckeeper
+endif
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 \ No newline at end of file
diff --git a/init.d/50git-ignore b/init.d/50git-ignore
index f931592..533782a 100755
--- a/init.d/50git-ignore
+++ b/init.d/50git-ignore
@@ -7,6 +7,11 @@ if [ ! -e .gitignore ]; then
# new and old versions of conffiles, stored by dpkg
*.dpkg-*
+# new and old versions of conffiles, stored by pacman
+*.pacnew
+*.pacorig
+*.pacsave
+
# mount(8) records system state here, no need to keep these in git
blkid.tab
blkid.tab.old
diff --git a/pacman-g2.hook b/pacman-g2.hook
new file mode 100644
index 0000000..4670a07
--- /dev/null
+++ b/pacman-g2.hook
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+pre_sysupgrade()
+{
+ if [ -x /usr/bin/etckeeper ]; then
+ etckeeper pre-apt
+ fi
+}
+
+post_sysupgrade()
+{
+ if [ -x /usr/bin/etckeeper ]; then
+ etckeeper post-apt
+ fi
+}
+
+op=$1
+shift
+$op $*
diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes
index d39401c..b68aadf 100755
--- a/pre-apt.d/50uncommitted-changes
+++ b/pre-apt.d/50uncommitted-changes
@@ -1,22 +1,29 @@
#!/bin/sh
set -e
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
+ RET="true"
+ if [ -e /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+ db_capb escape
+ db_title etckeeper
- db_reset etckeeper/unclean || true
- db_subst etckeeper/unclean STATUS $(git-status | debconf-escape -e) || true
- db_input critical etckeeper/unclean || true
- db_go || true
- db_get etckeeper/unclean
+ db_reset etckeeper/unclean || true
+ db_subst etckeeper/unclean STATUS $(git-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 apt run"; then
- db_input critical etckeeper/commit_failed || true
- db_go || true
- db_reset etckeeper/commit_failed || true
+ if [ -e /usr/share/debconf/confmodule ]; then
+ db_input critical etckeeper/commit_failed || true
+ db_go || true
+ db_reset etckeeper/commit_failed || true
+ fi
fi
fi
- db_reset etckeeper/unclean || true
+ if [ -e /usr/share/debconf/confmodule ]; then
+ db_reset etckeeper/unclean || true
+ fi
fi