From 4c3f828ef59889783c84b360f95d90ab37bc2511 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 4 Jan 2008 01:24:19 +0100 Subject: Add support for the pacman-g2 package manager. Signed-off-by: Miklos Vajna --- Makefile | 5 +++++ init.d/50git-ignore | 5 +++++ pacman-g2.hook | 19 +++++++++++++++++++ pre-apt.d/50uncommitted-changes | 31 +++++++++++++++++++------------ 4 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 pacman-g2.hook 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 -- cgit v1.2.3