wok-next annotate couchdb/receipt @ rev 16682
couchdb: create /var/run/couchdb in /etc/init.d/couchdb
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon May 19 07:53:54 2014 +0000 (2014-05-19) |
parents | eb8067417980 |
children | dfef8de3d270 |
rev | line source |
---|---|
claudinei@3810 | 1 # SliTaz package receipt. |
claudinei@3810 | 2 |
claudinei@3810 | 3 PACKAGE="couchdb" |
pascal@12428 | 4 VERSION="1.2.0" |
claudinei@3810 | 5 SOURCE="apache-couchdb" |
claudinei@3810 | 6 CATEGORY="development" |
claudinei@3810 | 7 SHORT_DESC="Apache CouchDB is document-oriented database." |
claudinei@3810 | 8 MAINTAINER="claudinei@slitaz.org" |
pascal@15579 | 9 LICENSE="Apache" |
claudinei@3810 | 10 TARBALL="$SOURCE-$VERSION.tar.gz" |
slaxemulator@6611 | 11 WEB_SITE="http://couchdb.apache.org" |
claudinei@3810 | 12 APACHE_MIRROR="http://mirrors.dedipower.com/ftp.apache.org/" |
pascal@12452 | 13 WGET_URL="$APACHE_MIRROR/$PACKAGE/releases/$VERSION/$TARBALL" |
claudinei@3810 | 14 |
pankso@12481 | 15 DEPENDS="erlang icu openssl util-linux-getopt spidermonkey libcurl curl" |
pankso@10007 | 16 BUILD_DEPENDS="erlang openssl-dev spidermonkey-dev curl-dev icu-dev" |
pankso@10006 | 17 |
claudinei@3810 | 18 # Rules to configure and make the package. |
claudinei@3810 | 19 compile_rules() |
claudinei@3810 | 20 { |
claudinei@3810 | 21 cd $src |
claudinei@3810 | 22 ./configure \ |
claudinei@3810 | 23 --prefix=/usr \ |
claudinei@3810 | 24 --sysconfdir=/etc \ |
claudinei@9170 | 25 --with-js-include=/usr/include/js \ |
claudinei@3810 | 26 --localstatedir=/var \ |
claudinei@3810 | 27 --infodir=/usr/share/info \ |
claudinei@3810 | 28 --mandir=/usr/share/man \ |
claudinei@3810 | 29 $CONFIGURE_ARGS && |
pascal@15579 | 30 make && make DESTDIR=$DESTDIR install |
claudinei@3810 | 31 } |
claudinei@3810 | 32 |
claudinei@3810 | 33 # Rules to gen a SliTaz package suitable for Tazpkg. |
claudinei@3810 | 34 genpkg_rules() |
claudinei@3810 | 35 { |
claudinei@3810 | 36 mkdir -p $fs/usr/share $fs/etc |
pascal@15579 | 37 cp -a $install/usr/bin $fs/usr |
pascal@15579 | 38 cp -a $install/usr/lib $fs/usr |
pascal@15579 | 39 cp -a $install/usr/share/couchdb $fs/usr/share |
pascal@15579 | 40 cp -a $install/var $fs |
pascal@15579 | 41 cp -a $install/etc/couchdb $fs/etc |
pascal@15579 | 42 cp -a $install/etc/default/couchdb $fs/etc/couchdb |
pascal@15579 | 43 cp -a $install/etc/init.d $fs/etc |
pascal@15579 | 44 cp -a $install/etc/logrotate.d $fs/etc |
pascal@16682 | 45 sed -i -e 's|/etc/default/couchdb|/etc/couchdb/couchdb|' \ |
pascal@16682 | 46 -e 's,.*case,[ -d /var/run/couchdb ] || mkdir -p /var/run/couchdb\n&,' \ |
pascal@16682 | 47 $fs/etc/init.d/couchdb |
claudinei@3810 | 48 } |
claudinei@3810 | 49 |
claudinei@3810 | 50 # Pre install commands for tazpkg |
claudinei@3810 | 51 # See if couchdb is already installed and, just in case, stop it |
claudinei@3810 | 52 pre_install() |
claudinei@3810 | 53 { |
claudinei@3810 | 54 INIT_FILE="/etc/init.d/$PACKAGE" |
claudinei@3810 | 55 echo "Processing pre-install commands..." |
claudinei@3810 | 56 [ -f $INIT_FILE ] && $INIT_FILE stop |
claudinei@3810 | 57 echo "Done..." |
claudinei@3810 | 58 } |
claudinei@3810 | 59 |
claudinei@3810 | 60 # Post install commands for tazpkg |
claudinei@3810 | 61 # Create couchdb user and group |
claudinei@3810 | 62 post_install() |
claudinei@3810 | 63 { |
claudinei@3810 | 64 LIBDIR="/var/lib/$PACKAGE" |
claudinei@3810 | 65 ETCDIR="/etc/$PACKAGE" |
claudinei@3810 | 66 LOGDIR="/var/log/$PACKAGE" |
claudinei@3810 | 67 RUNDIR="/var/run/$PACKAGE" |
claudinei@3810 | 68 |
claudinei@3810 | 69 echo "Processing post-install commands..." |
claudinei@3810 | 70 |
claudinei@9178 | 71 grep -q "$PACKAGE" /etc/group || addgroup -S $PACKAGE |
claudinei@9178 | 72 |
claudinei@9178 | 73 grep -q "$PACKAGE" /etc/passwd || adduser -S -D -H -h $LIBDIR \ |
claudinei@9178 | 74 -G $PACKAGE -s /bin/sh -g "CouchDB Administrator" $PACKAGE |
claudinei@3810 | 75 |
claudinei@3810 | 76 for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do |
claudinei@3810 | 77 chown -R $PACKAGE:$PACKAGE $DIR && chmod -R 0770 $DIR |
claudinei@3810 | 78 done |
claudinei@3810 | 79 |
claudinei@3810 | 80 echo "Done..." |
claudinei@3810 | 81 } |
claudinei@9178 | 82 |
claudinei@9178 | 83 # Pre and post remove commands for Tazpkg. |
claudinei@9178 | 84 pre_remove() |
claudinei@9178 | 85 { |
claudinei@9178 | 86 INIT_FILE="/etc/init.d/$PACKAGE" |
claudinei@9178 | 87 echo "Processing pre-remove commands..." |
claudinei@9178 | 88 [ -f $INIT_FILE ] && $INIT_FILE stop |
claudinei@9178 | 89 echo "Done..." |
claudinei@9178 | 90 } |
claudinei@9178 | 91 |
claudinei@9178 | 92 post_remove() |
claudinei@9178 | 93 { |
claudinei@9178 | 94 LIBDIR="/var/lib/$PACKAGE" |
claudinei@9178 | 95 ETCDIR="/etc/$PACKAGE" |
claudinei@9178 | 96 LOGDIR="/var/log/$PACKAGE" |
claudinei@9178 | 97 RUNDIR="/var/run/$PACKAGE" |
claudinei@9178 | 98 |
claudinei@9178 | 99 echo "Processing post-remove commands..." |
claudinei@9178 | 100 |
claudinei@9178 | 101 deluser $PACKAGE |
claudinei@9178 | 102 |
claudinei@9178 | 103 for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do |
claudinei@9178 | 104 rm -rf $DIR |
claudinei@9178 | 105 done |
claudinei@9178 | 106 |
claudinei@9178 | 107 echo "Done..." |
claudinei@9178 | 108 } |