wok view cyrus-imapd/receipt @ rev 25178

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