# SliTaz package receipt. PACKAGE="couchdb" VERSION="1.2.0" SOURCE="apache-couchdb" CATEGORY="development" SHORT_DESC="Apache CouchDB is document-oriented database." MAINTAINER="claudinei@slitaz.org" LICENSE="Apache" TARBALL="$SOURCE-$VERSION.tar.gz" WEB_SITE="https://couchdb.apache.org" WGET_URL="https://archive.apache.org/dist/couchdb/source/$VERSION/$TARBALL" DEPENDS="erlang icu openssl util-linux-getopt spidermonkey libcurl curl" BUILD_DEPENDS="erlang openssl-dev spidermonkey-dev curl-dev icu-dev" current_version() { wget -O - $WEB_SITE 2>/dev/null | \ sed '/DOWNLOAD/!d;s|.*version">||;s| .*||' } # Rules to configure and make the package. compile_rules() { ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --with-js-include=/usr/include/js \ --localstatedir=/var \ --infodir=/usr/share/info \ --mandir=/usr/share/man \ $CONFIGURE_ARGS && make && make DESTDIR=$DESTDIR install } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { mkdir -p $fs/usr/share $fs/etc cp -a $install/usr/bin $fs/usr cp -a $install/usr/lib $fs/usr cp -a $install/usr/share/couchdb $fs/usr/share cp -a $install/var $fs cp -a $install/etc/couchdb $fs/etc cp -a $install/etc/default/couchdb $fs/etc/couchdb cp -a $install/etc/init.d $fs/etc cp -a $install/etc/logrotate.d $fs/etc sed -i -e 's|/etc/default/couchdb|/etc/couchdb/couchdb|' \ -e 's,.*case,[ -d /var/run/couchdb ] || mkdir -p /var/run/couchdb\n&,' \ $fs/etc/init.d/couchdb } # Pre install commands for tazpkg # See if couchdb is already installed and, just in case, stop it pre_install() { INIT_FILE="/etc/init.d/$PACKAGE" [ -f "$1$INIT_FILE" ] && chroot "$1/" $INIT_FILE stop } # Post install commands for tazpkg # Create couchdb user and group post_install() { LIBDIR="/var/lib/$PACKAGE" ETCDIR="/etc/$PACKAGE" LOGDIR="/var/log/$PACKAGE" RUNDIR="/var/run/$PACKAGE" grep -q "$PACKAGE" "$1/etc/group" || chroot "$1/" addgroup -S $PACKAGE grep -q "$PACKAGE" "$1/etc/passwd" || chroot "$1/" adduser -S -D -H \ -h $LIBDIR -G $PACKAGE -s /bin/sh -g "CouchDB Administrator" $PACKAGE for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do chroot "$1/" chown -R $PACKAGE:$PACKAGE $DIR && chroot "$1/" chmod -R 0770 $DIR done } # Pre and post remove commands for Tazpkg. pre_remove() { INIT_FILE="/etc/init.d/$PACKAGE" [ -f "$1$INIT_FILE" ] && chroot "$1/" $INIT_FILE stop } post_remove() { LIBDIR="/var/lib/$PACKAGE" ETCDIR="/etc/$PACKAGE" LOGDIR="/var/log/$PACKAGE" RUNDIR="/var/run/$PACKAGE" chroot "$1/" deluser $PACKAGE for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do rm -rf "$1$DIR" done }