wok-6.x view cyrus-imapd/receipt @ rev 24126
Add eudev-lib
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Oct 14 06:54:52 2021 +0000 (2021-10-14) |
parents | 14a53b304e57 |
children | 2a0479881723 |
line source
1 # SliTaz package receipt.
3 PACKAGE="cyrus-imapd"
4 VERSION="3.0.13"
5 CATEGORY="network"
6 SHORT_DESC="IMAP server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="BSD"
9 WEB_SITE="https://www.cyrusimap.org/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="${WEB_SITE}/releases/$TARBALL"
14 DEPENDS="cyrus-sasl db jansson libcomerr libwrap net-snmp openssl perl
15 slitaz-base-files"
16 BUILD_DEPENDS="cyrus-sasl-dev db-dev icu-dev jansson-dev libcomerr-dev
17 openssl-dev perl util-linux-uuid-dev"
19 CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
21 # Rules to configure and make the package.
22 compile_rules()
23 {
24 export LDFLAGS="$LDFLAGS -lpthread"
26 ./configure \
27 --prefix=/usr \
28 --infodir=/usr/share/info \
29 --with-service-path=/usr/lib/cyrus \
30 --with-cyrus-prefix=/usr/lib/cyrus \
31 --with-com_err=yes \
32 --enable-murder \
33 --enable-replication \
34 --mandir=/usr/share/man \
35 $CONFIGURE_ARGS &&
36 make &&
37 make DESTDIR=$DESTDIR install
38 }
40 # Rules to gen a SliTaz package suitable for Tazpkg.
41 genpkg_rules()
42 {
43 mkdir -p $fs/usr/lib/cyrus
44 mkdir -p $fs/var/imap
45 mkdir -p $fs/var/spool/imap/stage.
47 cp -a $install/usr/bin $fs/usr
48 cp -a $install/usr/lib/libcyrus*.so* $fs/usr/lib
49 cp -a $install/usr/lib/perl5 $fs/usr/lib
50 strip -s $fs/usr/lib/lib*
51 cp $src/tools/mkimap $fs/usr/lib/cyrus
52 cp -a $stuff/etc $fs
53 cp $src/doc/examples/cyrus_conf/small.conf \
54 $fs/etc/cyrus.conf
55 for i in proc db socket log msg ptclient
56 do
57 mkdir -m 755 $fs/var/imap/$i
58 done
59 }
61 # Pre and post install commands for Tazpkg.
62 post_install()
63 {
64 # adduser cyrus if needed
65 if ! grep -q cyrus "$1/etc/passwd"
66 then
67 echo
68 echo -n "Adding user cyrus..."
69 chroot "$1/" adduser cyrus -D -H -S -h /tmp
70 chroot "$1/" sh -c 'echo "cyrus:cyrus" | chpasswd -m > /dev/null'
71 status
72 fi
74 # addgroup mail if needed
75 if ! grep -q mail "$1/etc/group"
76 then
77 echo
78 echo -n "Adding group mail..."
79 chroot "$1/" sh -c 'addgroup mail && addgroup cyrus mail'
80 status
81 fi
83 chroot "$1/" chown -R cyrus.mail /var/spool/imap /var/imap
84 while read name port end
85 do
86 grep -q $port "$1/etc/services" || \
87 echo "$name $port $end" >> "$1/etc/services"
88 done <<EOF
89 pop3 110/tcp pop-3
90 nntp 119/tcp readnews untp
91 imap 143/tcp imap2 imap4
92 imsp 406/tcp
93 nntps 563/tcp snntp
94 acap 674/tcp
95 imaps 993/tcp
96 pop3s 995/tcp
97 kpop 1109/tcp
98 sieve 2000/tcp
99 lmtp 2003/tcp
100 fud 4201/udp
101 EOF
103 [ "$1" ] || /etc/init.d/$PACKAGE start
104 if [ -f "$1/etc/init.d/postfix" ]
105 then
106 if ! grep -v ^# "$1/etc/postfix/main.cf" | grep -q lmtp:unix
107 then
108 echo
109 echo "Append to /etc/postfix/main.cf:"
110 echo -n " "
111 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
112 tee -a "$1/etc/postfix/main.cf"
113 if [ -z "$1" ]
114 then
115 /etc/init.d/postfix start || /etc/init.d/postfix reload
116 fi
117 fi
118 fi
120 msg="\\nCreating mailbox for"
121 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd")
122 do
123 echo -en "$msg $i"
124 msg=","
125 done
126 echo ""
128 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd")
129 do
130 echo "createmailbox user.$i"
131 done | chroot "$1/" cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
132 chroot "$1/" su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
134 cat <<EOF
135 ----
136 Users must have a password to access the mailbox.
137 To start $PACKAGE server you can run :
139 /etc/init.d/$PACKAGE start
141 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
142 ----
143 EOF
145 # A security hole with ssh...
146 [ -f "$1/etc/ssh/sshd_config" ] &&
147 ! grep -q cyrus "$1/etc/ssh/sshd_config" &&
148 echo "DenyUsers cyrus" >> "$1/etc/ssh/sshd_config"
149 }
151 post_remove()
152 {
153 deluser cyrus
154 delgroup mail
155 }