wok-current view cyrus-imapd/receipt @ rev 2900

Up: usbutils (0.81) and gzip usb.ids
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 05 12:01:51 2009 +0200 (2009-05-05)
parents 79e6c7e5b6d3
children 8d23268c7571
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 --mandir=/usr/share/man $CONFIGURE_ARGS &&
31 make &&
32 make DESTDIR=$PWD/_pkg install
33 }
35 # Rules to gen a SliTaz package suitable for Tazpkg.
36 genpkg_rules()
37 {
38 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
39 cp -a $_pkg/usr/bin $fs/usr
40 cp -a $_pkg/usr/cyrus $fs/usr
41 cp -a $_pkg/usr/lib/perl5 $fs/usr/lib
42 strip -s $fs/usr/cyrus/bin/*
43 cp $src/tools/mkimap $fs/usr/cyrus/bin
44 cp -a stuff/etc $fs
45 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
46 for i in proc db socket log msg ptclient; do
47 mkdir -m 755 $fs/var/imap/$i
48 done
49 }
51 # Pre and post install commands for Tazpkg.
52 post_install()
53 {
54 # adduser cyrus if needed
55 if ! grep -q cyrus $1/etc/passwd; then
56 echo -n "Adding user cyrus..."
57 chroot $1/ adduser cyrus -D -H -S -h /tmp
58 chroot $1/ sh -c 'echo "cyrus:cyrus" | chpasswd > /dev/null'
59 status
60 fi
61 # addgroup mail if needed
62 if ! grep -q mail $1/etc/group; then
63 echo -n "Adding group mail..."
64 chroot $1/ sh -c 'addgroup mail && addgroup cyrus mail'
65 status
66 fi
67 chroot $1/ chown -R cyrus.mail /var/spool/imap /var/imap
68 while read name port end; do
69 grep -q $port $1/etc/services || \
70 echo "$name $port $end" >> $1/etc/services
71 done <<EOF
72 pop3 110/tcp pop-3
73 nntp 119/tcp readnews untp
74 imap 143/tcp imap2 imap4
75 imsp 406/tcp
76 nntps 563/tcp snntp
77 acap 674/tcp
78 imaps 993/tcp
79 pop3s 995/tcp
80 kpop 1109/tcp
81 sieve 2000/tcp
82 lmtp 2003/tcp
83 fud 4201/udp
84 EOF
85 [ -z "$1" ] && /etc/init.d/$PACKAGE start
86 if [ -f $1/etc/init.d/postfix ]; then
87 if ! grep -v ^# $1/etc/postfix/main.cf | grep -q lmtp:unix; then
88 echo "Append to /etc/postfix/main.cf:"
89 echo -n " "
90 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
91 tee -a $1/etc/postfix/main.cf
92 if [ -z "$1" ]; then
93 /etc/init.d/postfix start || /etc/init.d/postfix reload
94 fi
95 fi
96 fi
97 msg="Creating mailbox for"
98 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
99 echo -n "$msg $i"
100 msg=","
101 done
102 echo ""
103 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
104 echo "createmailbox user.$i"
105 done | chroot $1/ cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
106 chroot $1/ su -c "/usr/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
107 cat <<EOF
108 ----
109 Users must have a password to access the mailbox.
110 To start $PACKAGE server you can run :
112 /etc/init.d/$PACKAGE start
114 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
115 ----
116 EOF
117 }
119 post_remove()
120 {
121 deluser cyrus
122 delgroup mail
123 }