wok-4.x view cyrus-imapd/receipt @ rev 4712

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