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

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