wok view cyrus-imapd/receipt @ rev 20319
Up tazlito (501)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun May 20 13:28:18 2018 +0200 (2018-05-20) |
parents | c8f848a49bc1 |
children | aaa3fcf79cf3 |
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 export LDFLAGS="$LDFLAGS -lpthread"
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-murder \
28 --enable-replication \
29 --mandir=/usr/share/man $CONFIGURE_ARGS &&
30 make &&
31 make DESTDIR=$DESTDIR install
32 }
34 # Rules to gen a SliTaz package suitable for Tazpkg.
35 genpkg_rules()
36 {
37 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
38 cp -a $install/usr/bin $fs/usr
39 cp -a $install/usr/lib/cyrus $fs/usr/lib
40 cp -a $install/usr/lib/perl5 $fs/usr/lib
41 strip -s $fs/usr/lib/cyrus/*
42 cp $src/tools/mkimap $fs/usr/lib/cyrus
43 cp -a $stuff/etc $fs
44 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
45 for i in proc db socket log msg ptclient; do
46 mkdir -m 755 $fs/var/imap/$i
47 done
48 }
50 # Pre and post install commands for Tazpkg.
51 post_install()
52 {
53 # adduser cyrus if needed
54 if ! grep -q cyrus "$1/etc/passwd"; then
55 echo
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 -m > /dev/null'
59 status
60 fi
61 # addgroup mail if needed
62 if ! grep -q mail "$1/etc/group"; then
63 echo
64 echo -n "Adding group mail..."
65 chroot "$1/" sh -c 'addgroup mail && addgroup cyrus mail'
66 status
67 fi
68 chroot "$1/" chown -R cyrus.mail /var/spool/imap /var/imap
69 while read name port end; do
70 grep -q $port "$1/etc/services" || \
71 echo "$name $port $end" >> "$1/etc/services"
72 done <<EOF
73 pop3 110/tcp pop-3
74 nntp 119/tcp readnews untp
75 imap 143/tcp imap2 imap4
76 imsp 406/tcp
77 nntps 563/tcp snntp
78 acap 674/tcp
79 imaps 993/tcp
80 pop3s 995/tcp
81 kpop 1109/tcp
82 sieve 2000/tcp
83 lmtp 2003/tcp
84 fud 4201/udp
85 EOF
86 [ "$1" ] || /etc/init.d/$PACKAGE start
87 if [ -f "$1/etc/init.d/postfix" ]; then
88 if ! grep -v ^# "$1/etc/postfix/main.cf" | grep -q lmtp:unix; then
89 echo
90 echo "Append to /etc/postfix/main.cf:"
91 echo -n " "
92 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
93 tee -a "$1/etc/postfix/main.cf"
94 if [ -z "$1" ]; then
95 /etc/init.d/postfix start || /etc/init.d/postfix reload
96 fi
97 fi
98 fi
99 msg="\\nCreating mailbox for"
100 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd"); do
101 echo -en "$msg $i"
102 msg=","
103 done
104 echo ""
105 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd"); do
106 echo "createmailbox user.$i"
107 done | chroot "$1/" cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
108 chroot "$1/" su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
109 cat <<EOF
110 ----
111 Users must have a password to access the mailbox.
112 To start $PACKAGE server you can run :
114 /etc/init.d/$PACKAGE start
116 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
117 ----
118 EOF
120 # A security hole with ssh...
121 [ -f "$1/etc/ssh/sshd_config" ] &&
122 ! grep -q cyrus "$1/etc/ssh/sshd_config" &&
123 echo "DenyUsers cyrus" >> "$1/etc/ssh/sshd_config"
124 }
126 post_remove()
127 {
128 deluser cyrus
129 delgroup mail
130 }