wok view cyrus-imapd/receipt @ rev 24436

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 13 13:09:42 2022 +0000 (2022-02-13)
parents c265f9cf4b14
children e8070450126d
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 # 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 ./configure \
34 --prefix=/usr \
35 --infodir=/usr/share/info \
36 --with-service-path=/usr/lib/cyrus \
37 --with-cyrus-prefix=/usr/lib/cyrus \
38 --with-com_err=yes \
39 --enable-murder \
40 --enable-replication \
41 --mandir=/usr/share/man \
42 $CONFIGURE_ARGS &&
43 make &&
44 make DESTDIR=$DESTDIR install
45 }
47 # Rules to gen a SliTaz package suitable for Tazpkg.
48 genpkg_rules()
49 {
50 mkdir -p $fs/usr/lib/cyrus
51 mkdir -p $fs/var/imap
52 mkdir -p $fs/var/spool/imap/stage.
54 cp -a $install/usr/bin $fs/usr
55 cp -a $install/usr/lib/libcyrus*.so* $fs/usr/lib
56 cp -a $install/usr/lib/perl5 $fs/usr/lib
57 strip -s $fs/usr/lib/lib*
58 cp $src/tools/mkimap $fs/usr/lib/cyrus
59 cp -a $stuff/etc $fs
60 cp $src/doc/examples/cyrus_conf/small.conf \
61 $fs/etc/cyrus.conf
62 for i in proc db socket log msg ptclient
63 do
64 mkdir -m 755 $fs/var/imap/$i
65 done
66 }
68 # Pre and post install commands for Tazpkg.
69 post_install()
70 {
71 # adduser cyrus if needed
72 if ! grep -q cyrus "$1/etc/passwd"
73 then
74 echo
75 echo -n "Adding user cyrus..."
76 chroot "$1/" adduser cyrus -D -H -S -h /tmp
77 chroot "$1/" sh -c 'echo "cyrus:cyrus" | chpasswd -m > /dev/null'
78 status
79 fi
81 # addgroup mail if needed
82 if ! grep -q mail "$1/etc/group"
83 then
84 echo
85 echo -n "Adding group mail..."
86 chroot "$1/" sh -c 'addgroup mail && addgroup cyrus mail'
87 status
88 fi
90 chroot "$1/" chown -R cyrus.mail /var/spool/imap /var/imap
91 while read name port end
92 do
93 grep -q $port "$1/etc/services" || \
94 echo "$name $port $end" >> "$1/etc/services"
95 done <<EOF
96 pop3 110/tcp pop-3
97 nntp 119/tcp readnews untp
98 imap 143/tcp imap2 imap4
99 imsp 406/tcp
100 nntps 563/tcp snntp
101 acap 674/tcp
102 imaps 993/tcp
103 pop3s 995/tcp
104 kpop 1109/tcp
105 sieve 2000/tcp
106 lmtp 2003/tcp
107 fud 4201/udp
108 EOF
110 [ "$1" ] || /etc/init.d/$PACKAGE start
111 if [ -f "$1/etc/init.d/postfix" ]
112 then
113 if ! grep -v ^# "$1/etc/postfix/main.cf" | grep -q lmtp:unix
114 then
115 echo
116 echo "Append to /etc/postfix/main.cf:"
117 echo -n " "
118 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
119 tee -a "$1/etc/postfix/main.cf"
120 if [ -z "$1" ]
121 then
122 /etc/init.d/postfix start || /etc/init.d/postfix reload
123 fi
124 fi
125 fi
127 msg="\\nCreating mailbox for"
128 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd")
129 do
130 echo -en "$msg $i"
131 msg=","
132 done
133 echo ""
135 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < "$1/etc/passwd")
136 do
137 echo "createmailbox user.$i"
138 done | chroot "$1/" cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
139 chroot "$1/" su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
141 cat <<EOF
142 ----
143 Users must have a password to access the mailbox.
144 To start $PACKAGE server you can run :
146 /etc/init.d/$PACKAGE start
148 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
149 ----
150 EOF
152 # A security hole with ssh...
153 [ -f "$1/etc/ssh/sshd_config" ] &&
154 ! grep -q cyrus "$1/etc/ssh/sshd_config" &&
155 echo "DenyUsers cyrus" >> "$1/etc/ssh/sshd_config"
156 }
158 post_remove()
159 {
160 deluser cyrus
161 delgroup mail
162 }