wok view cyrus-imapd/receipt @ rev 17041
slitaz-configs-base: /home may not exist (cookiso case)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Aug 19 13:06:45 2014 +0200 (2014-08-19) |
parents | 3ef10cee1665 |
children | 85b0b0c37b5d |
line source
1 # SliTaz package receipt.
3 PACKAGE="cyrus-imapd"
4 VERSION="2.4.16"
5 CATEGORY="network"
6 SHORT_DESC="IMAP server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="BSD"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://cyrusimap.web.cmu.edu/"
11 WGET_URL="ftp://ftp.cyrusimap.org/$PACKAGE/$TARBALL"
12 CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
14 BUILD_DEPENDS="libcomerr libcomerr-dev cyrus-sasl cyrus-sasl-dev openssl-dev \
15 db-dev perl"
16 DEPENDS="libcomerr cyrus-sasl openssl db perl libwrap slitaz-base-files \
17 net-snmp"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 cd $src
23 ./configure --prefix=/usr --infodir=/usr/share/info \
24 --with-service-path=/usr/lib/cyrus \
25 --with-cyrus-prefix=/usr/lib/cyrus \
26 --with-com_err=yes \
27 --mandir=/usr/share/man $CONFIGURE_ARGS &&
28 make &&
29 make DESTDIR=$DESTDIR install
30 }
32 # Rules to gen a SliTaz package suitable for Tazpkg.
33 genpkg_rules()
34 {
35 mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
36 cp -a $install/usr/bin $fs/usr
37 cp -a $install/usr/lib/cyrus $fs/usr/lib
38 cp -a $install/usr/lib/perl5 $fs/usr/lib
39 strip -s $fs/usr/lib/cyrus/*
40 cp $src/tools/mkimap $fs/usr/lib/cyrus
41 cp -a $stuff/etc $fs
42 cp $src/master/conf/small.conf $fs/etc/cyrus.conf
43 for i in proc db socket log msg ptclient; do
44 mkdir -m 755 $fs/var/imap/$i
45 done
46 }
48 # Pre and post install commands for Tazpkg.
49 post_install()
50 {
51 # adduser cyrus if needed
52 if ! grep -q cyrus $1/etc/passwd; then
53 echo -n "Adding user cyrus..."
54 chroot $1/ adduser cyrus -D -H -S -h /tmp
55 chroot $1/ sh -c 'echo "cyrus:cyrus" | chpasswd -m > /dev/null'
56 status
57 fi
58 # addgroup mail if needed
59 if ! grep -q mail $1/etc/group; then
60 echo -n "Adding group mail..."
61 chroot $1/ sh -c 'addgroup mail && addgroup cyrus mail'
62 status
63 fi
64 chroot $1/ chown -R cyrus.mail /var/spool/imap /var/imap
65 while read name port end; do
66 grep -q $port $1/etc/services || \
67 echo "$name $port $end" >> $1/etc/services
68 done <<EOF
69 pop3 110/tcp pop-3
70 nntp 119/tcp readnews untp
71 imap 143/tcp imap2 imap4
72 imsp 406/tcp
73 nntps 563/tcp snntp
74 acap 674/tcp
75 imaps 993/tcp
76 pop3s 995/tcp
77 kpop 1109/tcp
78 sieve 2000/tcp
79 lmtp 2003/tcp
80 fud 4201/udp
81 EOF
82 [ -z "$1" ] && /etc/init.d/$PACKAGE start
83 if [ -f $1/etc/init.d/postfix ]; then
84 if ! grep -v ^# $1/etc/postfix/main.cf | grep -q lmtp:unix; then
85 echo "Append to /etc/postfix/main.cf:"
86 echo -n " "
87 echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
88 tee -a $1/etc/postfix/main.cf
89 if [ -z "$1" ]; then
90 /etc/init.d/postfix start || /etc/init.d/postfix reload
91 fi
92 fi
93 fi
94 msg="Creating mailbox for"
95 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
96 echo -n "$msg $i"
97 msg=","
98 done
99 echo ""
100 for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < $1/etc/passwd); do
101 echo "createmailbox user.$i"
102 done | chroot $1/ cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
103 chroot $1/ su -c "/usr/lib/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
104 cat <<EOF
105 ----
106 Users must have a password to access the mailbox.
107 To start $PACKAGE server you can run :
109 /etc/init.d/$PACKAGE start
111 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
112 ----
113 EOF
115 # A security hole with ssh...
116 [ -f $1/etc/ssh/sshd_config ] &&
117 ! grep -q cyrus $1/etc/ssh/sshd_config &&
118 echo "DenyUsers cyrus" >> $1/etc/ssh/sshd_config
119 }
121 post_remove()
122 {
123 deluser cyrus
124 delgroup mail
125 }