wok view cyrus-imapd/receipt @ rev 1210

Add cyrus-imapd
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 09 14:25:01 2008 +0000 (2008-08-09)
parents
children 65d3dfc87776
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 postfix perl"
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 patch -p1 < ../stuff/50-FTBFS-gcc-4.0-fix.dpatch
20 patch -p0 < ../stuff/p1.patch
21 patch -p0 < ../stuff/p2.patch
22 ./configure --prefix=/usr --infodir=/usr/share/info \
23 --mandir=/usr/share/man $CONFIGURE_ARGS
24 make
25 make DESTDIR=$PWD/_pkg install
26 }
28 # Rules to gen a SliTaz package suitable for Tazpkg.
29 genpkg_rules()
30 {
31 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
32 cp -a $_pkg/usr/bin $fs/usr
33 cp -a $_pkg/usr/cyrus $fs/usr
34 cp -a $_pkg/usr/lib/perl5 $fs/usr/lib
35 strip -s $fs/usr/cyrus/bin/*
36 cp $src/tools/mkimap $fs/usr/cyrus/bin
37 cp -a stuff/etc $fs
38 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
39 for i in proc db socket log msg ptclient; do
40 mkdir -m 755 $fs/var/imap/$i
41 done
42 }
44 # Pre and post install commands for Tazpkg.
45 post_install()
46 {
47 ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
48 $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
49 etc/cyrus.conf
50 etc/imapd.conf
51 EOT
52 # adduser cyrus if needed
53 if ! grep -q cyrus $1/etc/passwd; then
54 echo -n "Adding user cyrus..."
55 chroot $1/ adduser cyrus -D -H -S -h /tmp
56 echo "cyrus:cyrus" | chpasswd > /dev/null
57 status
58 fi
59 # addgroup mail if needed
60 if ! grep -q mail $1/etc/group; then
61 echo -n "Adding group mail..."
62 chroot $1/ addgroup mail && addgroup cyrus mail
63 status
64 fi
65 chown -R cyrus.mail /var/spool/imap /var/imap
66 while read name port end; do
67 grep -q $port /etc/services || \
68 echo "$name $port $end" >> /etc/services
69 done <<EOF
70 pop3 110/tcp pop-3
71 nntp 119/tcp readnews untp
72 imap 143/tcp imap2 imap4
73 imsp 406/tcp
74 nntps 563/tcp snntp
75 acap 674/tcp
76 imaps 993/tcp
77 pop3s 995/tcp
78 kpop 1109/tcp
79 sieve 2000/tcp
80 lmtp 2003/tcp
81 fud 4201/udp
82 EOF
83 /etc/init.d/$PACKAGE start
84 if [ -f /etc/init.d/postfix ]; then
85 if ! grep -v ^# /etc/postfix/main.cf | grep -q lmtp:unix; then
86 echo "Append to /etc/postfix/main.cf:"
87 echo -n " "
88 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
89 tee -a /etc/postfix/main.cf
90 /etc/init.d/postfix start || /etc/init.d/postfix reload
91 fi
92 fi
93 msg="Creating mailbox for"
94 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
95 echo -n "$msg $i"
96 msg=","
97 done
98 echo ""
99 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
100 echo "createmailbox user.$i"
101 done | cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
102 su -c "/usr/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
103 cat <<EOF
104 ----
105 Users must have a password to access the mailbox.
106 To start $PACKAGE server you can run :
108 /etc/init.d/$PACKAGE start
110 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
111 ----
112 EOF
113 }
115 post_remove()
116 {
117 deluser cyrus
118 delgroup mail
119 }
121 repack_cleanup()
122 {
123 zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
124 }