diff options
Diffstat (limited to 'community/couchdb')
-rw-r--r-- | community/couchdb/PKGBUILD | 21 | ||||
-rw-r--r-- | community/couchdb/couchdb.rc | 157 |
2 files changed, 167 insertions, 11 deletions
diff --git a/community/couchdb/PKGBUILD b/community/couchdb/PKGBUILD index d7656d5e3..5edbe1e2e 100644 --- a/community/couchdb/PKGBUILD +++ b/community/couchdb/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 80235 2012-11-18 10:29:50Z andrea $ +# $Id: PKGBUILD 82191 2013-01-11 10:20:37Z spupykin $ # Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> # Contributor: Vitaliy Berdinskikh ur6lad[at]i.ua # Contributor: Michael Fellinger <m.fellinger@gmail.com> pkgname=couchdb -pkgver=1.2.0 -pkgrel=6 +pkgver=1.2.1 +pkgrel=1 pkgdesc="A document-oriented database that can be queried and indexed in a MapReduce fashion using JSON" arch=('i686' 'x86_64' 'mips64el') url="http://couchdb.apache.org" @@ -16,15 +16,15 @@ options=('!libtool') backup=('etc/couchdb/local.ini' 'etc/conf.d/couchdb' 'etc/logrotate.d/couchdb') -source=("http://www.apache.org/dist/couchdb/releases/${pkgver}/apache-${pkgname}-${pkgver}.tar.gz"{,.asc} +source=("http://apache-mirror.rbc.ru/pub/apache/couchdb/$pkgver/apache-couchdb-$pkgver.tar.gz"{,.asc} "couchdb.service" "couchdb.tmpfiles" - "rc-script.patch") -md5sums=('a5cbbcaac288831b3d8a08b725657f10' - '890a85b22219ea113a4901a289c442f8' + "couchdb.rc") +md5sums=('df75b03e56c2431ede7625200f0d44a7' + 'e6e943c1da93cfcb41a4286daa80195d' '8914a7ffc6745f94106d96206709acb4' '1e254ebe32eeb061be64193bafa35dbf' - '8a3b1a1ff98a6411827ad991db7a355b') + 'a75ee9b310a950eea13b07274b7a0669') build() { cd "$srcdir/apache-$pkgname-$pkgver" @@ -33,8 +33,6 @@ build() { --sysconfdir=/etc \ --localstatedir=/var make - - patch -R etc/init/couchdb <$srcdir/rc-script.patch } package() { @@ -42,9 +40,10 @@ package() { make DESTDIR="$pkgdir" install install -Dm644 etc/default/couchdb $pkgdir/etc/conf.d/couchdb - sed -i 's|\(CONFIGURATION_FILE=/etc/\)default\(/couchdb\)|\1conf.d\2|' $pkgdir/etc/rc.d/couchdb sed -i 's|\(COUCHDB_OPTIONS=\)|\1"-p /var/run/couchdb/couchdb.pid"|' $pkgdir/etc/conf.d/couchdb + install -Dm755 $srcdir/couchdb.rc $pkgdir/etc/rc.d/couchdb + rm -rf $pkgdir/etc/default/ $pkgdir/var/run install -Dm0644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service diff --git a/community/couchdb/couchdb.rc b/community/couchdb/couchdb.rc new file mode 100644 index 000000000..af41c6460 --- /dev/null +++ b/community/couchdb/couchdb.rc @@ -0,0 +1,157 @@ +#!/bin/bash +. /etc/rc.conf +. /etc/rc.d/functions + +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +### BEGIN INIT INFO +# Provides: couchdb +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Apache CouchDB init script +# Description: Apache CouchDB init script for the database server. +### END INIT INFO + +SCRIPT_OK=0 +SCRIPT_ERROR=1 + +DESCRIPTION="database server" +NAME=couchdb +SCRIPT_NAME=`basename $0` +COUCHDB=/usr/bin/couchdb +CONFIGURATION_FILE=/etc/conf.d/couchdb +RUN_DIR=/var/run/couchdb +LSB_LIBRARY=/lib/lsb/init-functions + +if test ! -x $COUCHDB; then + exit $SCRIPT_ERROR +fi + +if test -r $CONFIGURATION_FILE; then + . $CONFIGURATION_FILE +fi + +log_daemon_msg () { + stat_busy $@ +} + +log_end_msg () { + if test "$1" != "0"; then + stat_fail + else + stat_done + fi + return $1 +} + +if test -r $LSB_LIBRARY; then + . $LSB_LIBRARY +fi + +run_command () { + command="$1" + if test -n "$COUCHDB_OPTIONS"; then + command="$command $COUCHDB_OPTIONS" + fi + if test -n "$COUCHDB_USER"; then + if su $COUCHDB_USER -s /bin/bash -c "$command"; then + return $SCRIPT_OK + else + return $SCRIPT_ERROR + fi + else + if $command; then + return $SCRIPT_OK + else + return $SCRIPT_ERROR + fi + fi +} + +start_couchdb () { + # Start Apache CouchDB as a background process. + + mkdir -p "$RUN_DIR" + chown -R $COUCHDB_USER "$RUN_DIR" + command="$COUCHDB -b" + if test -n "$COUCHDB_STDOUT_FILE"; then + command="$command -o $COUCHDB_STDOUT_FILE" + fi + if test -n "$COUCHDB_STDERR_FILE"; then + command="$command -e $COUCHDB_STDERR_FILE" + fi + if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then + command="$command -r $COUCHDB_RESPAWN_TIMEOUT" + fi + run_command "$command" > /dev/null +} + +stop_couchdb () { + # Stop the running Apache CouchDB process. + + run_command "$COUCHDB -d" > /dev/null +} + +display_status () { + # Display the status of the running Apache CouchDB process. + + run_command "$COUCHDB -s" +} + +parse_script_option_list () { + # Parse arguments passed to the script and take appropriate action. + + case "$1" in + start) + log_daemon_msg "Starting $DESCRIPTION" $NAME + if start_couchdb; then + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi + ;; + stop) + log_daemon_msg "Stopping $DESCRIPTION" $NAME + if stop_couchdb; then + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi + ;; + restart) + log_daemon_msg "Restarting $DESCRIPTION" $NAME + if stop_couchdb; then + if start_couchdb; then + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi + else + log_end_msg $SCRIPT_ERROR + fi + ;; + status) + display_status + ;; + *) + cat << EOF >&2 +Usage: $SCRIPT_NAME {start|stop|restart|status} +EOF + exit $SCRIPT_ERROR + ;; + esac +} + +parse_script_option_list $@ |