From e837af8a31801a4fc459516cb434f8d4da49fe5a Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Wed, 26 Apr 2017 04:24:24 +0000 Subject: [PATCH] added community/couchdb --- community/couchdb/PKGBUILD | 69 ++++++++++++++++++++++++++++++ community/couchdb/couchdb.install | 16 +++++++ community/couchdb/couchdb.service | 15 +++++++ community/couchdb/couchdb.tmpfiles | 1 + community/couchdb/datadirs.ini | 3 ++ 5 files changed, 104 insertions(+) create mode 100644 community/couchdb/PKGBUILD create mode 100644 community/couchdb/couchdb.install create mode 100644 community/couchdb/couchdb.service create mode 100644 community/couchdb/couchdb.tmpfiles create mode 100644 community/couchdb/datadirs.ini diff --git a/community/couchdb/PKGBUILD b/community/couchdb/PKGBUILD new file mode 100644 index 000000000..1ca847041 --- /dev/null +++ b/community/couchdb/PKGBUILD @@ -0,0 +1,69 @@ +# $Id$ +# Maintainer: Sergej Pupykin +# Contributor: Vitaliy Berdinskikh ur6lad[at]i.ua +# Contributor: Michael Fellinger + +# ALARM: Kevin Mihelich +# - patch and rebuild rebar on AArch64 + +pkgname=couchdb +pkgver=2.0.0 +pkgrel=9 +pkgdesc="A document-oriented database that can be queried and indexed in a MapReduce fashion using JSON" +arch=('i686' 'x86_64') +url="http://couchdb.apache.org" +license=('APACHE') +depends=('icu' 'erlang-nox' 'js185' 'openssl-1.0' 'curl' 'util-linux') +makedepends=('autoconf-archive' 'git') +install=couchdb.install +backup=('etc/couchdb/local.ini' + 'etc/couchdb/vm.args') +validpgpkeys=('E0AF0A194D55C84E4A19A801CDB0C0F904F4EE9B' + 'D2B17F9DA23C0A10991AF2E3D9EE01E47852AEE4') +source=("http://www.eu.apache.org/dist/couchdb/source/$pkgver/apache-couchdb-$pkgver.tar.gz"{,.asc} + "https://github.com/rebar/rebar/commit/f9b850c428dae6cf6673ff076d863d5b6c343569.patch" + "couchdb.service" + "couchdb.tmpfiles" + "datadirs.ini") +md5sums=('402fc02df28a5297a56cedebbae42524' + 'SKIP' + 'ed7d01517ab6bc82fce1871715046ae4' + '38cea6d9b533a22dadc22538a921c282' + '1e254ebe32eeb061be64193bafa35dbf' + 'cd649a705805e6193ae72aea33a2e4bd') + +prepare() { + cd "$srcdir/apache-couchdb-$pkgver" + sed -i 's|$ROOTDIR/etc/vm.args|/etc/couchdb/vm.args|' rel/overlay/bin/couchdb + if [[ $CARCH == aarch64 ]]; then + cd src/rebar + patch -p1 -i "$srcdir/f9b850c428dae6cf6673ff076d863d5b6c343569.patch" + ./bootstrap + cp rebar ../../bin + fi +} + +build() { + cd "$srcdir/apache-couchdb-$pkgver" + ./configure + make release +} + +package() { + cd "$srcdir/apache-couchdb-$pkgver" + install -dm0755 "$pkgdir"/usr/lib/ + install -dm0755 "$pkgdir"/etc/couchdb/ + install -dm0755 "$pkgdir"/var/lib/couchdb/ + + cp -r rel/couchdb "$pkgdir"/usr/lib/couchdb + mv "$pkgdir"/usr/lib/couchdb/etc/local.ini "$pkgdir"/etc/couchdb/local.ini + mv "$pkgdir"/usr/lib/couchdb/etc/vm.args "$pkgdir"/etc/couchdb/vm.args + + # use system erts +# rm -rf "$pkgdir"/usr/lib/couchdb/erts-* +# _erts=$(cd /usr/lib/erlang/ && ls -1d erts-*) +# ln -s /usr/lib/erlang/${_erts} "$pkgdir"/usr/lib/couchdb/${_erts} + + install -Dm0644 "$srcdir"/$pkgname.service "$pkgdir"/usr/lib/systemd/system/$pkgname.service + install -Dm0644 "$srcdir"/datadirs.ini "$pkgdir"/usr/lib/couchdb/etc/datadirs.ini +} diff --git a/community/couchdb/couchdb.install b/community/couchdb/couchdb.install new file mode 100644 index 000000000..56e8fec68 --- /dev/null +++ b/community/couchdb/couchdb.install @@ -0,0 +1,16 @@ +post_install() { + id couchdb &>/dev/null || \ + useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb + chown couchdb.daemon /etc/couchdb/local.ini + chown -R couchdb.daemon /var/lib/couchdb +} + +pre_upgrade() { + id couchdb &>/dev/null || \ + useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb +} + +post_upgrade() { + chown couchdb.daemon /etc/couchdb/local.ini + chown -R couchdb.daemon /var/lib/couchdb +} diff --git a/community/couchdb/couchdb.service b/community/couchdb/couchdb.service new file mode 100644 index 000000000..f2a82b2f4 --- /dev/null +++ b/community/couchdb/couchdb.service @@ -0,0 +1,15 @@ +[Unit] +Description=CouchDB Server + +[Service] +User=couchdb +Type=simple +Environment="ERL_FLAGS=-couch_ini /usr/lib/couchdb/etc/default.ini /usr/lib/couchdb/etc/datadirs.ini /etc/couchdb/local.ini" +ExecStart=/usr/lib/couchdb/bin/couchdb +ProtectSystem=true +ProtectHome=true +NoNewPrivileges=true +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/community/couchdb/couchdb.tmpfiles b/community/couchdb/couchdb.tmpfiles new file mode 100644 index 000000000..de4378746 --- /dev/null +++ b/community/couchdb/couchdb.tmpfiles @@ -0,0 +1 @@ +d /run/couchdb 0755 couchdb daemon - diff --git a/community/couchdb/datadirs.ini b/community/couchdb/datadirs.ini new file mode 100644 index 000000000..4deec0b90 --- /dev/null +++ b/community/couchdb/datadirs.ini @@ -0,0 +1,3 @@ +[couchdb] +database_dir = /var/lib/couchdb +view_index_dir = /var/lib/couchdb