Skip to content

Instantly share code, notes, and snippets.

@fbettag
Created November 22, 2012 17:26
Show Gist options
  • Save fbettag/4132264 to your computer and use it in GitHub Desktop.
Save fbettag/4132264 to your computer and use it in GitHub Desktop.
My aports APKBUILD files for alpine linux cfengine setup. includes tokyocabinet and kyotocabinet.
diff --git a/testing/cfengine/APKBUILD b/testing/cfengine/APKBUILD
new file mode 100644
index 0000000..8b632b3
--- /dev/null
+++ b/testing/cfengine/APKBUILD
@@ -0,0 +1,40 @@
+# Contributor: Franz Bettag <[email protected]>
+# Maintainer:
+pkgname=cfengine
+pkgver=3.3.8
+pkgrel=0
+pkgdesc="CFEngine Configuration Management"
+url="http://cfengine.com/"
+arch="all"
+license="GPLv3"
+depends=""
+makedepends="tokyocabinet openssl-dev pcre-dev"
+options="libtool"
+install=""
+subpackages=""
+source="http://cfengine.com/source-code/download?file=$pkgname-$pkgver.tar.gz"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $( pwd )/../../*; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i $i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure || return 1
+
+ make all || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="ba585e8ba6c40c7bbd624ec2271898aa download?file=cfengine-3.3.8.tar.gz"
diff --git a/testing/cfengine/alpinelinux.patch b/testing/cfengine/alpinelinux.patch
new file mode 100644
index 0000000..45c4994
--- /dev/null
+++ b/testing/cfengine/alpinelinux.patch
@@ -0,0 +1,71 @@
+--- cfengine-3.3.8/masterfiles/cfengine_stdlib.cf
++++ cfengine-3.3.8-alpine/masterfiles/cfengine_stdlib.cf
+@@ -1647,6 +1647,31 @@
+
+ ##
+
++body package_method alpinelinux
++{
++ package_changes => "individual";
++
++ package_list_command => "/sbin/apk info -v";
++
++ # Remember to escape special characters like |
++
++ package_list_name_regex => "([^\s]+)-.*";
++ package_list_version_regex => "[^\s]+-([^\s]+).*";
++
++ package_name_regex => "([^\s]+)-.*";
++ package_version_regex => "[^\s]+-([^\s]+).*";
++
++ package_installed_regex => ".*";
++
++ package_name_convention => "$(name)-$(version)";
++
++
++package_add_command => "/sbin/apk add";
++package_delete_command => "/sbin/apk del";
++}
++
++##
++
+ # Single bundle for all the similar managers simplifies promises
+
+ body package_method generic
+@@ -1741,6 +1766,21 @@
+ package_name_convention => "$(name)-$(version)";
+ package_add_command => "/usr/sbin/pkg_add -r";
+ package_delete_command => "/usr/sbin/pkg_delete";
++
++alpinelinux::
++ package_changes => "individual";
++ package_list_command => "/sbin/apk info -v";
++ package_list_name_regex => "([^\s]+)-.*";
++ package_list_version_regex => "[^\s]+-([^\s]+).*";
++ package_name_regex => "([^\s]+)-.*";
++ package_version_regex => "[^\s]+-([^\s]+).*";
++ package_installed_regex => ".*";
++ package_name_convention => "$(name)-$(version)";
++ package_add_command => "/sbin/apk add";
++ package_delete_command => "/sbin/apk del";
++}
++
++
+ }
+
+ ##
+--- cfengine-3.3.8/src/sysinfo.c
++++ cfengine-3.3.8-alpine/src/sysinfo.c
+@@ -783,6 +783,12 @@
+ NewClass("UnitedLinux");
+ }
+
++ if (cfstat("/etc/alpine-release", &statbuf) != -1)
++ {
++ CfOut(cf_verbose, "", "This appears to be an AlpineLinux system.\n");
++ NewClass("alpinelinux");
++ }
++
+ if (cfstat("/etc/gentoo-release", &statbuf) != -1)
+ {
+ CfOut(cf_verbose, "", "This appears to be a gentoo system.\n");
diff --git a/testing/kyotocabinet/APKBUILD b/testing/kyotocabinet/APKBUILD
new file mode 100644
index 0000000..616c738
--- /dev/null
+++ b/testing/kyotocabinet/APKBUILD
@@ -0,0 +1,39 @@
+# Contributor: Franz Bettag <[email protected]>
+# Maintainer:
+pkgname=kyotocabinet
+pkgver=1.2.76
+pkgrel=0
+pkgdesc="GDBM, QDBM and Tokyo Cabinet successor"
+url="http://falllabs.com/kyotocabinet"
+arch="all"
+license="GPLv3"
+depends=""
+makedepends="zlib-dev"
+install=""
+subpackages=""
+source="http://fallabs.com/$pkgname/pkg/$pkgname-$pkgver.tar.gz"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ LDFLAGS="-lpthread" ./configure --prefix /usr || return 1
+
+ make all || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="b925d369d7ed4a37cf0013409046738c kyotocabinet-1.2.76.tar.gz"
diff --git a/testing/tokyocabinet/APKBUILD b/testing/tokyocabinet/APKBUILD
new file mode 100644
index 0000000..738ceb5
--- /dev/null
+++ b/testing/tokyocabinet/APKBUILD
@@ -0,0 +1,39 @@
+# Contributor: Franz Bettag <[email protected]>
+# Maintainer:
+pkgname=tokyocabinet
+pkgver=1.4.48
+pkgrel=0
+pkgdesc="GDBM and QDBM successor"
+url="http://falllabs.com/tokyocabinet"
+arch="all"
+license="LGPL"
+depends=""
+makedepends="zlib-dev bzip2-dev"
+install=""
+subpackages=""
+source="http://fallabs.com/$pkgname/$pkgname-$pkgver.tar.gz"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ LDFLAGS="-lpthread" ./configure --prefix /usr || return 1
+
+ make all || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="fd03df6965f8f56dd5b8518ca43b4f5e tokyocabinet-1.4.48.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment