aboutsummaryrefslogtreecommitdiffstats
path: root/testing/etckeeper
diff options
context:
space:
mode:
Diffstat (limited to 'testing/etckeeper')
-rw-r--r--testing/etckeeper/APKBUILD43
-rw-r--r--testing/etckeeper/apk-commit_hook17
-rw-r--r--testing/etckeeper/etckeeper.post-install10
-rw-r--r--testing/etckeeper/etckeeper.pre-deinstall6
4 files changed, 76 insertions, 0 deletions
diff --git a/testing/etckeeper/APKBUILD b/testing/etckeeper/APKBUILD
new file mode 100644
index 0000000000..37d9bb6327
--- /dev/null
+++ b/testing/etckeeper/APKBUILD
@@ -0,0 +1,43 @@
+# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
+
+pkgname=etckeeper
+pkgver=1.18.6
+pkgrel=1
+pkgdesc="Store /etc in git."
+url="https://github.com/joeyh/etckeeper"
+arch="noarch"
+license="GPL2"
+depends="findutils git perl"
+subpackages="$pkgname-doc"
+install="$pkgname.post-install $pkgname.pre-deinstall"
+source="$pkgname-$pkgver.tar.gz::https://github.com/joeyh/etckeeper/$_pkgname/archive/$pkgver.tar.gz
+ apk-commit_hook
+ $pkgname.post-install
+ $pkgname.pre-deinstall
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ cd "$builddir"
+ sed -i 's|^PYTHON=python$|PYTHON=/bin/false|' Makefile || return 1
+ sed -i 's/_PACKAGE_MANAGER=.*/_PACKAGE_MANAGER=apk/' "$builddir"/etckeeper.conf || return 1
+}
+
+package() {
+ cd "$builddir"
+ make install DESTDIR="$pkgdir" || return 1
+ rm -rf "$pkgdir"/lib/systemd || return 1
+ rmdir "$pkgdir"/lib/ || return 1
+ rm -rf "$pkgdir"/etc/apt || return 1
+
+ install -m755 -D "$builddir"/debian/cron.daily \
+ "$pkgdir"/etc/periodic/daily/"$pkgname" || return 1
+
+ install -m755 -D "$srcdir"/apk-commit_hook \
+ "$pkgdir"/etc/apk/commit_hooks.d/"$pkgname"|| return 1
+}
+
+sha512sums="a5a3a4677f31cf1d010ab40ed37ce602c71c2e8ebf2273bf8be6dc8209f603ae0fc6a2c0d5d60d9a9d9aa4f3e7b7c0037534890cbc67b38132e5f654abcda04c etckeeper-1.18.6.tar.gz
+2b1a29d31b6e7cf4ddb05de9b5e088b5747c2abfb2d63f9bddd25f4b7dc8503d457df7fd644afe5bd6fea6a5285a111a47c0489d24378b483c1e026cc11c6bf7 apk-commit_hook
+6662bcc15aa9815578442e175c2edaf76f4eba4e73caa739887df9182c2cf6c640709d392087c2c28a8efca5c8fd9369cad4ad1e1c84fa5ccbf52af2bd1751fb etckeeper.post-install
+5a49895ac126150f2939486c4a736339847cc79bee8bb84797a063c924aa643d2b1a8721c91e1fb7107947e817fe4c19f3c55f1d22b29a566daf668bbbb77dc6 etckeeper.pre-deinstall"
diff --git a/testing/etckeeper/apk-commit_hook b/testing/etckeeper/apk-commit_hook
new file mode 100644
index 0000000000..6f0a4c043c
--- /dev/null
+++ b/testing/etckeeper/apk-commit_hook
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+
+[ -x /usr/bin/etckeeper ] || exit
+
+case "$1" in
+ pre-commit)
+ etckeeper pre-install
+ ;;
+ post-commit)
+ etckeeper post-install
+ ;;
+
+ *)
+ echo "$0: Un-handled action: $1"
+ ;;
+esac
diff --git a/testing/etckeeper/etckeeper.post-install b/testing/etckeeper/etckeeper.post-install
new file mode 100644
index 0000000000..5bb094cb22
--- /dev/null
+++ b/testing/etckeeper/etckeeper.post-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+[ -e /etc/.git ] && exit 0
+
+if etckeeper init; then
+ etckeeper commit "initial commit"
+ # we are in trigger context so the apk database
+ # contains info before the change takes effect
+ /etc/etckeeper/pre-install.d/10packagelist
+fi
diff --git a/testing/etckeeper/etckeeper.pre-deinstall b/testing/etckeeper/etckeeper.pre-deinstall
new file mode 100644
index 0000000000..9170848b38
--- /dev/null
+++ b/testing/etckeeper/etckeeper.pre-deinstall
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+etckeeper uninit
+
+rm -f /var/cache/etckeeper/packagelist.fmt
+rm -f /var/cache/etckeeper/packagelist.pre-install