wok annotate cyrus-imapd/receipt @ rev 11904

cyrus-imapd: fix compile_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 29 20:32:37 2012 +0100 (2012-02-29)
parents 76f0b0ebe349
children ec5cb3f92f0e
rev   line source
pascal@1210 1 # SliTaz package receipt.
pascal@1210 2
pascal@1210 3 PACKAGE="cyrus-imapd"
slaxemulator@6430 4 VERSION="2.3.16"
pascal@1210 5 CATEGORY="network"
pascal@1210 6 SHORT_DESC="IMAP server."
pascal@1210 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@1210 8 TARBALL="$PACKAGE-$VERSION.tar.gz"
pascal@1210 9 WEB_SITE="http://cyrusimap.web.cmu.edu/"
pascal@1210 10 WGET_URL="ftp://ftp.andrew.cmu.edu/pub/cyrus/$TARBALL"
pascal@11855 11 BUILD_DEPENDS="libcomerr libcomerr-dev cyrus-sasl cyrus-sasl-dev openssl-dev \
pascal@11855 12 db-dev perl"
pascal@4999 13 DEPENDS="libcomerr cyrus-sasl openssl db perl libwrap slitaz-base-files \
pascal@4999 14 net-snmp"
pascal@1210 15 CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
pascal@1210 16
pascal@1210 17 # Rules to configure and make the package.
pascal@1210 18 compile_rules()
pascal@1210 19 {
pascal@1210 20 cd $src
pascal@1210 21 ./configure --prefix=/usr --infodir=/usr/share/info \
pascal@4205 22 --with-service-path=/usr/lib/cyrus \
pascal@5036 23 --with-cyrus-prefix=/usr/lib/cyrus \
pascal@11904 24 --with-com_err=yes \
pascal@1553 25 --mandir=/usr/share/man $CONFIGURE_ARGS &&
pascal@1553 26 make &&
pascal@1210 27 make DESTDIR=$PWD/_pkg install
pascal@1210 28 }
pascal@1210 29
pascal@1210 30 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1210 31 genpkg_rules()
pascal@1210 32 {
pascal@1210 33 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
pascal@1210 34 cp -a $_pkg/usr/bin $fs/usr
pascal@4205 35 cp -a $_pkg/usr/lib/cyrus $fs/usr/lib
pascal@1210 36 cp -a $_pkg/usr/lib/perl5 $fs/usr/lib
slaxemulator@6430 37 strip -s $fs/usr/lib/cyrus/*
slaxemulator@6430 38 cp $src/tools/mkimap $fs/usr/lib/cyrus
pankso@9697 39 cp -a $stuff/etc $fs
pascal@1210 40 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
pascal@1210 41 for i in proc db socket log msg ptclient; do
pascal@1210 42 mkdir -m 755 $fs/var/imap/$i
pascal@1210 43 done
pascal@1210 44 }
pascal@1210 45
pascal@1210 46 # Pre and post install commands for Tazpkg.
pascal@1210 47 post_install()
pascal@1210 48 {
pascal@1210 49 # adduser cyrus if needed
pascal@1210 50 if ! grep -q cyrus $1/etc/passwd; then
pascal@1210 51 echo -n "Adding user cyrus..."
pascal@1210 52 chroot $1/ adduser cyrus -D -H -S -h /tmp
pascal@2369 53 chroot $1/ sh -c 'echo "cyrus:cyrus" | chpasswd > /dev/null'
pascal@1210 54 status
pascal@1210 55 fi
pascal@1210 56 # addgroup mail if needed
pascal@1210 57 if ! grep -q mail $1/etc/group; then
pascal@1210 58 echo -n "Adding group mail..."
pascal@2369 59 chroot $1/ sh -c 'addgroup mail && addgroup cyrus mail'
pascal@1210 60 status
pascal@1210 61 fi
pascal@2389 62 chroot $1/ chown -R cyrus.mail /var/spool/imap /var/imap
pascal@1210 63 while read name port end; do
pascal@2389 64 grep -q $port $1/etc/services || \
pascal@2389 65 echo "$name $port $end" >> $1/etc/services
pascal@1210 66 done <<EOF
pascal@1210 67 pop3 110/tcp pop-3
pascal@1210 68 nntp 119/tcp readnews untp
pascal@1210 69 imap 143/tcp imap2 imap4
pascal@1210 70 imsp 406/tcp
pascal@1210 71 nntps 563/tcp snntp
pascal@1210 72 acap 674/tcp
pascal@1210 73 imaps 993/tcp
pascal@1210 74 pop3s 995/tcp
pascal@1210 75 kpop 1109/tcp
pascal@1210 76 sieve 2000/tcp
pascal@1210 77 lmtp 2003/tcp
pascal@1210 78 fud 4201/udp
pascal@1210 79 EOF
pascal@1659 80 [ -z "$1" ] && /etc/init.d/$PACKAGE start
pascal@2389 81 if [ -f $1/etc/init.d/postfix ]; then
pascal@2389 82 if ! grep -v ^# $1/etc/postfix/main.cf | grep -q lmtp:unix; then
pascal@1210 83 echo "Append to /etc/postfix/main.cf:"
pascal@1210 84 echo -n " "
pascal@1210 85 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
pascal@2389 86 tee -a $1/etc/postfix/main.cf
pascal@2389 87 if [ -z "$1" ]; then
pascal@2389 88 /etc/init.d/postfix start || /etc/init.d/postfix reload
pascal@2389 89 fi
pascal@1210 90 fi
pascal@1210 91 fi
pascal@1210 92 msg="Creating mailbox for"
pascal@2389 93 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
pascal@1210 94 echo -n "$msg $i"
pascal@1210 95 msg=","
pascal@1210 96 done
pascal@1210 97 echo ""
pascal@2389 98 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
pascal@1210 99 echo "createmailbox user.$i"
pascal@2389 100 done | chroot $1/ cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
pascal@4205 101 chroot $1/ su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
pascal@1210 102 cat <<EOF
pascal@1210 103 ----
pascal@1210 104 Users must have a password to access the mailbox.
pascal@1210 105 To start $PACKAGE server you can run :
pascal@1210 106
pascal@1210 107 /etc/init.d/$PACKAGE start
pascal@1210 108
pascal@1210 109 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
pascal@1210 110 ----
pascal@1210 111 EOF
pascal@1210 112 }
pascal@1210 113
pascal@1210 114 post_remove()
pascal@1210 115 {
pascal@1210 116 deluser cyrus
pascal@1210 117 delgroup mail
pascal@1210 118 }