wok view cyrus-imapd/receipt @ rev 1754
slitaz-tools: add tazctrlbox
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Nov 24 21:41:45 2008 +0100 (2008-11-24) |
parents | 65d3dfc87776 |
children | bd6010223726 |
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"
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 ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
55 $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
56 etc/cyrus.conf
57 etc/imapd.conf
58 EOT
59 # adduser cyrus if needed
60 if ! grep -q cyrus $1/etc/passwd; then
61 echo -n "Adding user cyrus..."
62 chroot $1/ adduser cyrus -D -H -S -h /tmp
63 echo "cyrus:cyrus" | chpasswd > /dev/null
64 status
65 fi
66 # addgroup mail if needed
67 if ! grep -q mail $1/etc/group; then
68 echo -n "Adding group mail..."
69 chroot $1/ addgroup mail && addgroup cyrus mail
70 status
71 fi
72 chown -R cyrus.mail /var/spool/imap /var/imap
73 while read name port end; do
74 grep -q $port /etc/services || \
75 echo "$name $port $end" >> /etc/services
76 done <<EOF
77 pop3 110/tcp pop-3
78 nntp 119/tcp readnews untp
79 imap 143/tcp imap2 imap4
80 imsp 406/tcp
81 nntps 563/tcp snntp
82 acap 674/tcp
83 imaps 993/tcp
84 pop3s 995/tcp
85 kpop 1109/tcp
86 sieve 2000/tcp
87 lmtp 2003/tcp
88 fud 4201/udp
89 EOF
90 [ -z "$1" ] && /etc/init.d/$PACKAGE start
91 if [ -z "$1" -a -f /etc/init.d/postfix ]; then
92 if ! grep -v ^# /etc/postfix/main.cf | grep -q lmtp:unix; then
93 echo "Append to /etc/postfix/main.cf:"
94 echo -n " "
95 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
96 tee -a /etc/postfix/main.cf
97 /etc/init.d/postfix start || /etc/init.d/postfix reload
98 fi
99 fi
100 msg="Creating mailbox for"
101 [ -z "$1" ] &&
102 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
103 echo -n "$msg $i"
104 msg=","
105 done
106 echo ""
107 [ -z "$1" ] &&
108 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
109 echo "createmailbox user.$i"
110 done | cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
111 su -c "/usr/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
112 cat <<EOF
113 ----
114 Users must have a password to access the mailbox.
115 To start $PACKAGE server you can run :
117 /etc/init.d/$PACKAGE start
119 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
120 ----
121 EOF
122 }
124 post_remove()
125 {
126 deluser cyrus
127 delgroup mail
128 }
130 repack_cleanup()
131 {
132 zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
133 }