wok view couchdb/receipt @ rev 18730

Quote root dir in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 20 15:13:45 2015 +0100 (2015-12-20)
parents dfef8de3d270
children d6ca18366f41
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 "$1$INIT_FILE" ] && chroot "$1/" $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" "$1/etc/group" || chroot "$1/" addgroup -S $PACKAGE
73 grep -q "$PACKAGE" "$1/etc/passwd" || chroot "$1/" adduser -S -D -H \
74 -h $LIBDIR -G $PACKAGE -s /bin/sh -g "CouchDB Administrator" $PACKAGE
76 for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do
77 chroot "$1/" chown -R $PACKAGE:$PACKAGE $DIR &&
78 chroot "$1/" chmod -R 0770 $DIR
79 done
81 echo "Done..."
82 }
84 # Pre and post remove commands for Tazpkg.
85 pre_remove()
86 {
87 INIT_FILE="/etc/init.d/$PACKAGE"
88 echo "Processing pre-remove commands..."
89 [ -f "$1$INIT_FILE" ] && chroot "$1/" $INIT_FILE stop
90 echo "Done..."
91 }
93 post_remove()
94 {
95 LIBDIR="/var/lib/$PACKAGE"
96 ETCDIR="/etc/$PACKAGE"
97 LOGDIR="/var/log/$PACKAGE"
98 RUNDIR="/var/run/$PACKAGE"
100 echo "Processing post-remove commands..."
102 chroot "$1/" deluser $PACKAGE
104 for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do
105 rm -rf "$1$DIR"
106 done
108 echo "Done..."
109 }