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