wok-current view cyrus-imapd/receipt @ rev 8700

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