wok view cyrus-imapd/receipt @ rev 17211

Up cyrus-imapd (2.4.17)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Oct 10 15:17:08 2014 +0200 (2014-10-10)
parents eb8067417980
children f3a5dddc7405
line source
1 # SliTaz package receipt.
3 PACKAGE="cyrus-imapd"
4 VERSION="2.4.17"
5 CATEGORY="network"
6 SHORT_DESC="IMAP server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="BSD"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://cyrusimap.web.cmu.edu/"
11 WGET_URL="ftp://ftp.cyrusimap.org/$PACKAGE/$TARBALL"
12 CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
14 BUILD_DEPENDS="libcomerr libcomerr-dev cyrus-sasl cyrus-sasl-dev openssl-dev \
15 db-dev perl"
16 DEPENDS="libcomerr cyrus-sasl openssl db perl libwrap slitaz-base-files \
17 net-snmp"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 cd $src
23 ./configure --prefix=/usr --infodir=/usr/share/info \
24 --with-service-path=/usr/lib/cyrus \
25 --with-cyrus-prefix=/usr/lib/cyrus \
26 --with-com_err=yes \
27 --enable-replication \
28 --mandir=/usr/share/man $CONFIGURE_ARGS &&
29 make &&
30 make DESTDIR=$DESTDIR install
31 }
33 # Rules to gen a SliTaz package suitable for Tazpkg.
34 genpkg_rules()
35 {
36 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
37 cp -a $install/usr/bin $fs/usr
38 cp -a $install/usr/lib/cyrus $fs/usr/lib
39 cp -a $install/usr/lib/perl5 $fs/usr/lib
40 strip -s $fs/usr/lib/cyrus/*
41 cp $src/tools/mkimap $fs/usr/lib/cyrus
42 cp -a $stuff/etc $fs
43 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
44 for i in proc db socket log msg ptclient; do
45 mkdir -m 755 $fs/var/imap/$i
46 done
47 }
49 # Pre and post install commands for Tazpkg.
50 post_install()
51 {
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 chroot $1/ sh -c 'echo "cyrus:cyrus" | chpasswd -m > /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/ sh -c 'addgroup mail && addgroup cyrus mail'
63 status
64 fi
65 chroot $1/ chown -R cyrus.mail /var/spool/imap /var/imap
66 while read name port end; do
67 grep -q $port $1/etc/services || \
68 echo "$name $port $end" >> $1/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 [ -z "$1" ] && /etc/init.d/$PACKAGE start
84 if [ -f $1/etc/init.d/postfix ]; then
85 if ! grep -v ^# $1/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 $1/etc/postfix/main.cf
90 if [ -z "$1" ]; then
91 /etc/init.d/postfix start || /etc/init.d/postfix reload
92 fi
93 fi
94 fi
95 msg="Creating mailbox for"
96 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
97 echo -n "$msg $i"
98 msg=","
99 done
100 echo ""
101 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
102 echo "createmailbox user.$i"
103 done | chroot $1/ cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
104 chroot $1/ su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
105 cat <<EOF
106 ----
107 Users must have a password to access the mailbox.
108 To start $PACKAGE server you can run :
110 /etc/init.d/$PACKAGE start
112 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
113 ----
114 EOF
116 # A security hole with ssh...
117 [ -f $1/etc/ssh/sshd_config ] &&
118 ! grep -q cyrus $1/etc/ssh/sshd_config &&
119 echo "DenyUsers cyrus" >> $1/etc/ssh/sshd_config
120 }
122 post_remove()
123 {
124 deluser cyrus
125 delgroup mail
126 }