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