wok-next view cyrus-imapd/receipt @ rev 21153

Small updates.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jan 31 16:45:41 2019 +0200 (2019-01-31)
parents d958fec46c9f
children adee07f5e767
line source
1 # SliTaz package receipt v2.
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 WEB_SITE="http://cyrusimap.web.cmu.edu/"
10 REPOLOGY="cyrus-imapd2"
12 TARBALL="$PACKAGE-$VERSION.tar.gz"
13 WGET_URL="ftp://ftp.cyrusimap.org/$PACKAGE/$TARBALL"
15 BUILD_DEPENDS="libcomerr libcomerr-dev cyrus-sasl cyrus-sasl-dev openssl-dev \
16 db-dev perl-dev zlib-dev"
17 SPLIT="$PACKAGE-dev"
19 compile_rules() {
20 export LDFLAGS="$LDFLAGS -lpthread"
21 ./configure \
22 --prefix=/usr \
23 --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 \
30 $CONFIGURE_ARGS &&
31 make &&
32 make DESTDIR=$install install
33 }
35 genpkg_rules() {
36 case $PACKAGE in
37 cyrus-imapd)
38 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
39 cp -a $install/usr/bin $fs/usr
40 cp -a $install/usr/lib/cyrus $fs/usr/lib
41 cp -a $install/usr/lib/perl5 $fs/usr/lib
42 strip -s $fs/usr/lib/cyrus/*
43 cp $src/tools/mkimap $fs/usr/lib/cyrus
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 CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
50 DEPENDS="libcomerr cyrus-sasl openssl db perl libwrap \
51 slitaz-base-files net-snmp"
52 ;;
53 *-dev)
54 mkdir -p $fs/usr/lib
55 cp -a $install/usr/lib/lib* $fs/usr/lib
56 cp -a $install/usr/include $fs/usr
57 ;;
58 esac
59 }
61 post_install_cyrus_imapd() {
62 # adduser cyrus if needed
63 if ! grep -q cyrus "$1/etc/passwd"; then
64 echo -n "Adding user cyrus..."
65 chroot "$1/" adduser cyrus -D -H -S -h /tmp
66 chroot "$1/" sh -c 'echo "cyrus:cyrus" | chpasswd -m > /dev/null'
67 status
68 fi
69 # addgroup mail if needed
70 if ! grep -q mail "$1/etc/group"; then
71 echo -n "Adding group mail..."
72 chroot "$1/" sh -c 'addgroup mail && addgroup cyrus mail'
73 status
74 fi
75 chroot "$1/" chown -R cyrus.mail /var/spool/imap /var/imap
76 while read name port end; do
77 grep -q $port "$1/etc/services" || \
78 echo "$name $port $end" >> "$1/etc/services"
79 done <<EOF
80 pop3 110/tcp pop-3
81 nntp 119/tcp readnews untp
82 imap 143/tcp imap2 imap4
83 imsp 406/tcp
84 nntps 563/tcp snntp
85 acap 674/tcp
86 imaps 993/tcp
87 pop3s 995/tcp
88 kpop 1109/tcp
89 sieve 2000/tcp
90 lmtp 2003/tcp
91 fud 4201/udp
92 EOF
93 [ "$1" ] || /etc/init.d/$PACKAGE start
94 if [ -f "$1/etc/init.d/postfix" ]; then
95 if ! grep -v ^# "$1/etc/postfix/main.cf" | grep -q lmtp:unix; then
96 echo "Append to /etc/postfix/main.cf:"
97 echo -n " "
98 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
99 tee -a "$1/etc/postfix/main.cf"
100 if [ -z "$1" ]; then
101 /etc/init.d/postfix start || /etc/init.d/postfix reload
102 fi
103 fi
104 fi
105 msg="Creating mailbox for"
106 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd"); do
107 echo -n "$msg $i"
108 msg=","
109 done
110 echo ""
111 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd"); do
112 echo "createmailbox user.$i"
113 done | chroot "$1/" cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
114 chroot "$1/" su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
115 [ -n "$quiet" ] || cat <<EOF
117 .---------------------------------------------------.
118 | Users must have a password to access the mailbox. |
119 |---------------------------------------------------|
120 | To start $PACKAGE server you can run: |
121 | |
122 | /etc/init.d/$PACKAGE start |
123 | |
124 | Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf |
125 '---------------------------------------------------'
126 EOF
128 # A security hole with ssh...
129 [ -f "$1/etc/ssh/sshd_config" ] &&
130 ! grep -q cyrus "$1/etc/ssh/sshd_config" &&
131 echo "DenyUsers cyrus" >> "$1/etc/ssh/sshd_config"
132 }
134 post_remove_cyrus_imapd() {
135 deluser cyrus
136 delgroup mail
137 }