wok rev 1210

Add cyrus-imapd
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 09 14:25:01 2008 +0000 (2008-08-09)
parents f6a6d0028db1
children 16fdba95d583
files cyrus-imapd/receipt cyrus-imapd/stuff/50-FTBFS-gcc-4.0-fix.dpatch cyrus-imapd/stuff/etc/imapd.conf cyrus-imapd/stuff/etc/init.d/cyrus-imapd cyrus-imapd/stuff/p1.patch cyrus-imapd/stuff/p2.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/cyrus-imapd/receipt	Sat Aug 09 14:25:01 2008 +0000
     1.3 @@ -0,0 +1,124 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="cyrus-imapd"
     1.7 +VERSION="2.2.12"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="IMAP server."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.12 +WEB_SITE="http://cyrusimap.web.cmu.edu/"
    1.13 +WGET_URL="ftp://ftp.andrew.cmu.edu/pub/cyrus/$TARBALL"
    1.14 +BUILD_DEPENDS="libcomerr-dev cyrus-sasl cyrus-sasl-dev openssl-dev db-dev"
    1.15 +DEPENDS="libcomerr cyrus-sasl openssl db postfix perl"
    1.16 +CONFIG_FILES="/etc/imapd.conf /etc/cyrus.conf"
    1.17 +
    1.18 +# Rules to configure and make the package.
    1.19 +compile_rules()
    1.20 +{
    1.21 +	cd $src
    1.22 +	patch -p1 < ../stuff/50-FTBFS-gcc-4.0-fix.dpatch
    1.23 +	patch -p0 < ../stuff/p1.patch
    1.24 +	patch -p0 < ../stuff/p2.patch
    1.25 +	./configure --prefix=/usr --infodir=/usr/share/info \
    1.26 +	--mandir=/usr/share/man $CONFIGURE_ARGS
    1.27 +	make
    1.28 +	make DESTDIR=$PWD/_pkg install
    1.29 +}
    1.30 +
    1.31 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.32 +genpkg_rules()
    1.33 +{
    1.34 +	mkdir -p $fs/usr/lib $fs/var/imap $fs/var/spool/imap/stage.
    1.35 +	cp -a $_pkg/usr/bin $fs/usr
    1.36 +	cp -a $_pkg/usr/cyrus $fs/usr
    1.37 +	cp -a $_pkg/usr/lib/perl5 $fs/usr/lib
    1.38 +	strip -s $fs/usr/cyrus/bin/*
    1.39 +	cp $src/tools/mkimap $fs/usr/cyrus/bin
    1.40 +	cp -a stuff/etc $fs
    1.41 +	cp $src/master/conf/small.conf $fs/etc/cyrus.conf
    1.42 +	for i in proc db socket log msg ptclient; do
    1.43 +		mkdir -m 755 $fs/var/imap/$i
    1.44 +	done
    1.45 +}
    1.46 +
    1.47 +# Pre and post install commands for Tazpkg.
    1.48 +post_install()
    1.49 +{
    1.50 +	( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
    1.51 +		$1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
    1.52 +etc/cyrus.conf
    1.53 +etc/imapd.conf
    1.54 +EOT
    1.55 +        # adduser cyrus if needed
    1.56 +	if ! grep -q cyrus $1/etc/passwd; then
    1.57 +		echo -n "Adding user cyrus..."
    1.58 +		chroot $1/ adduser cyrus -D -H -S -h /tmp
    1.59 +		echo "cyrus:cyrus" | chpasswd > /dev/null
    1.60 +		status
    1.61 +	fi
    1.62 +	# addgroup mail if needed
    1.63 +	if ! grep -q mail $1/etc/group; then
    1.64 +		echo -n "Adding group mail..."
    1.65 +		chroot $1/ addgroup mail && addgroup cyrus mail
    1.66 +		status
    1.67 +	fi
    1.68 +	chown -R cyrus.mail /var/spool/imap /var/imap
    1.69 +	while read name port end; do
    1.70 +		grep -q $port /etc/services || \
    1.71 +			echo "$name		$port	$end" >> /etc/services
    1.72 +	done <<EOF
    1.73 +pop3 110/tcp pop-3
    1.74 +nntp 119/tcp readnews untp
    1.75 +imap 143/tcp imap2 imap4
    1.76 +imsp 406/tcp 
    1.77 +nntps 563/tcp snntp
    1.78 +acap 674/tcp
    1.79 +imaps 993/tcp
    1.80 +pop3s 995/tcp
    1.81 +kpop 1109/tcp
    1.82 +sieve 2000/tcp
    1.83 +lmtp 2003/tcp
    1.84 +fud 4201/udp
    1.85 +EOF
    1.86 +	/etc/init.d/$PACKAGE start
    1.87 +	if [ -f /etc/init.d/postfix ]; then
    1.88 +		if ! grep -v ^# /etc/postfix/main.cf | grep -q lmtp:unix; then
    1.89 +			echo "Append to /etc/postfix/main.cf:"
    1.90 +			echo -n "    "
    1.91 +			echo "mailbox_transport = lmtp:unix:/var/imap/socket/lmtp" | \
    1.92 +				tee -a /etc/postfix/main.cf
    1.93 +			/etc/init.d/postfix start || /etc/init.d/postfix reload
    1.94 +		fi
    1.95 +	fi
    1.96 +	msg="Creating mailbox for"
    1.97 +	for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
    1.98 +		echo -n "$msg $i"
    1.99 +		msg=","
   1.100 +	done
   1.101 +	echo ""
   1.102 +	for i in root $(awk -F: '{ if ($3 >= 1000) print $1 }' < /etc/passwd); do
   1.103 +		echo "createmailbox user.$i"
   1.104 +	done | cyradm -u cyrus -w cyrus 127.0.0.1 >/dev/null 2>&1
   1.105 +	su -c "/usr/cyrus/bin/reconstruct" cyrus >/dev/null 2>&1
   1.106 +	cat <<EOF
   1.107 +----
   1.108 +Users must have a password to access the mailbox.
   1.109 +To start $PACKAGE server you can run :
   1.110 +
   1.111 +    /etc/init.d/$PACKAGE start
   1.112 +
   1.113 +Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
   1.114 +----
   1.115 +EOF
   1.116 +}
   1.117 +
   1.118 +post_remove()
   1.119 +{
   1.120 +	deluser cyrus
   1.121 +	delgroup mail
   1.122 +}
   1.123 +
   1.124 +repack_cleanup()
   1.125 +{
   1.126 +        zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
   1.127 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/cyrus-imapd/stuff/50-FTBFS-gcc-4.0-fix.dpatch	Sat Aug 09 14:25:01 2008 +0000
     2.3 @@ -0,0 +1,27 @@
     2.4 +#! /bin/sh /usr/share/dpatch/dpatch-run
     2.5 +## 50-FTBFS-gcc-4.0-fix.dpatch by Ondřej Surý <ondrej@sury.org>
     2.6 +##
     2.7 +## All lines beginning with `## DP:' are a description of the patch.
     2.8 +## DP: Fix FTBFS when compiling with gcc-4.0, there is imapopts is used before declared
     2.9 +
    2.10 +@DPATCH@
    2.11 +diff -urN cyrus22-imapd-2.2.12~/tools/config2header cyrus22-imapd-2.2.12/tools/config2header
    2.12 +--- cyrus22-imapd-2.2.12~/tools/config2header	2004-06-22 21:02:31.000000000 +0200
    2.13 ++++ cyrus22-imapd-2.2.12/tools/config2header	2005-06-22 07:56:17.180293688 +0200
    2.14 +@@ -214,7 +214,6 @@
    2.15 + print HFILE <<EOF
    2.16 +   IMAPOPT_LAST
    2.17 + };
    2.18 +-extern struct imapopt_s imapopts[];
    2.19 + 
    2.20 + enum enum_value {
    2.21 +   IMAP_ENUM_ZERO = 0,
    2.22 +@@ -260,6 +259,8 @@
    2.23 + 
    2.24 + print HFILE <<EOF
    2.25 + };
    2.26 ++extern struct imapopt_s imapopts[];
    2.27 ++
    2.28 + #endif /* INCLUDED_IMAPOPTIONS_H */
    2.29 + EOF
    2.30 +     ;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/cyrus-imapd/stuff/etc/imapd.conf	Sat Aug 09 14:25:01 2008 +0000
     3.3 @@ -0,0 +1,15 @@
     3.4 +configdirectory: /var/imap
     3.5 +partition-default: /var/spool/imap
     3.6 +lmtpsocket: /var/imap/socket/lmtp
     3.7 +
     3.8 +# space-separated users who have admin rights for all services.
     3.9 +admins: cyrus
    3.10 +
    3.11 +# The mechanism(s) used by the server to verify plaintext passwords. Possible
    3.12 +# values are "saslauthd", "auxprop", "pwcheck" and "alwaystrue".  They
    3.13 +# are tried in order, you can specify more than one, separated by spaces.
    3.14 +sasl_pwcheck_method: saslauthd
    3.15 +
    3.16 +# Force PLAIN/LOGIN authentication only
    3.17 +sasl_mech_list: PLAIN
    3.18 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/cyrus-imapd/stuff/etc/init.d/cyrus-imapd	Sat Aug 09 14:25:01 2008 +0000
     4.3 @@ -0,0 +1,66 @@
     4.4 +#!/bin/sh
     4.5 +# /etc/init.d/cyrus-imapd : Start, stop and restart IMAP server on SliTaz, at 
     4.6 +# boot time or with the command line.
     4.7 +#
     4.8 +# To start IMAP server at boot time, just put cyrus-imapd in the $RUN_DAEMONS
     4.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    4.10 +#
    4.11 +. /etc/init.d/rc.functions
    4.12 +. /etc/daemons.conf
    4.13 +
    4.14 +NAME=cyrus-imapd
    4.15 +DESC="IMAP server"
    4.16 +DAEMON=/usr/cyrus/bin/master
    4.17 +OPTIONS=$CYRUS_OPTIONS
    4.18 +PIDFILE=/var/run/cyrus.master.pid
    4.19 +[ -n "$OPTIONS" ] || OPTIONS="-d -p $PIDFILE"
    4.20 +
    4.21 +case "$1" in
    4.22 +  start)
    4.23 +    if [ -f $PIDFILE ] ; then
    4.24 +      echo "$NAME already running."
    4.25 +      exit 1
    4.26 +    fi
    4.27 +    if ! pidof saslauthd > /dev/null; then
    4.28 +      /etc/init.d/cyrus-sasl start
    4.29 +    fi
    4.30 +    echo -n "Starting $DESC: $NAME... "
    4.31 +    $DAEMON $OPTIONS
    4.32 +    status
    4.33 +    sleep 2
    4.34 +    ;;
    4.35 +  stop)
    4.36 +    if [ ! -f $PIDFILE ] ; then
    4.37 +      echo "$NAME is not running."
    4.38 +      exit 1
    4.39 +    fi
    4.40 +    echo -n "Stopping $DESC: $NAME... "
    4.41 +    kill `cat $PIDFILE`
    4.42 +    ps x | grep -q `cat $PIDFILE` || rm -f $PIDFILE
    4.43 +    status
    4.44 +    ;;
    4.45 +  restart)
    4.46 +    if [ ! -f $PIDFILE ] ; then
    4.47 +      echo "$NAME is not running."
    4.48 +      exit 1
    4.49 +    fi
    4.50 +    echo -n "Restarting $DESC: $NAME... "
    4.51 +    kill `cat $PIDFILE`
    4.52 +    if ps x | grep -q `cat $PIDFILE`; then
    4.53 +    	false
    4.54 +    else
    4.55 +    	rm -f $PIDFILE
    4.56 +    	sleep 2
    4.57 +    	$DAEMON $OPTIONS
    4.58 +    fi
    4.59 +    status
    4.60 +    ;;
    4.61 +  *)
    4.62 +    echo ""
    4.63 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    4.64 +    echo ""
    4.65 +    exit 1
    4.66 +    ;;
    4.67 +esac
    4.68 +
    4.69 +exit 0
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/cyrus-imapd/stuff/p1.patch	Sat Aug 09 14:25:01 2008 +0000
     5.3 @@ -0,0 +1,19 @@
     5.4 +diff -u lib.old/cyrusdb_berkeley.c lib/cyrusdb_berkeley.c
     5.5 +--- lib.old/cyrusdb_berkeley.c	2007-04-05 01:23:42.518845824 +0200
     5.6 ++++ lib/cyrusdb_berkeley.c	2007-04-05 01:22:20.000000000 +0200
     5.7 +@@ -159,7 +159,15 @@
     5.8 + 	syslog(LOG_WARNING,
     5.9 + 	       "DBERROR: invalid berkeley_locks_max value, using internal default");
    5.10 +     } else {
    5.11 ++#if DB_VERSION_MAJOR >= 4
    5.12 ++  r = dbenv->set_lk_max_locks(dbenv, opt);
    5.13 ++  if (!r)
    5.14 ++  r = dbenv->set_lk_max_lockers(dbenv, opt);
    5.15 ++  if (!r)
    5.16 ++  r = dbenv->set_lk_max_objects(dbenv, opt);
    5.17 ++#else
    5.18 + 	r = dbenv->set_lk_max(dbenv, opt);
    5.19 ++#endif
    5.20 + 	if (r) {
    5.21 + 	    dbenv->err(dbenv, r, "set_lk_max");
    5.22 + 	    syslog(LOG_ERR, "DBERROR: set_lk_max(): %s", db_strerror(r));
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/cyrus-imapd/stuff/p2.patch	Sat Aug 09 14:25:01 2008 +0000
     6.3 @@ -0,0 +1,11 @@
     6.4 +--- cmulocal/berkdb.m4.orig	2007-05-01 18:05:00.000000000 +0200
     6.5 ++++ cmulocal/berkdb.m4	2007-05-01 18:05:17.000000000 +0200
     6.6 +@@ -212,7 +212,7 @@
     6.7 + 	fi
     6.8 + 
     6.9 + 	saved_LIBS=$LIBS
    6.10 +-        for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
    6.11 ++        for dbname in db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
    6.12 +           do
    6.13 + 	    LIBS="$saved_LIBS -l$dbname"
    6.14 + 	    AC_TRY_LINK([#include <db.h>],