From 886d3d0994eb8e9f3e797155619619e0ef1353f8 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 May 2011 22:33:52 +0000 Subject: Sun May 8 22:33:51 UTC 2011 --- testing/dovecot/PKGBUILD | 74 +++++++++++++++++++++++++++++++++++++++++ testing/dovecot/dovecot.install | 57 +++++++++++++++++++++++++++++++ testing/dovecot/dovecot.sh | 36 ++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 testing/dovecot/PKGBUILD create mode 100644 testing/dovecot/dovecot.install create mode 100755 testing/dovecot/dovecot.sh (limited to 'testing/dovecot') diff --git a/testing/dovecot/PKGBUILD b/testing/dovecot/PKGBUILD new file mode 100644 index 000000000..7b9a0304c --- /dev/null +++ b/testing/dovecot/PKGBUILD @@ -0,0 +1,74 @@ +# $Id: PKGBUILD 121982 2011-05-01 01:05:24Z stephane $ +# Contributor: Paul Mattal +# Contributor: Federico Quagliata (quaqo) +# Contributor: GARETTE Emmanuel +# Maintainer: Andreas Radke + +pkgname=dovecot +pkgver=2.0.12 +pkgrel=2 +pkgdesc="An IMAP and POP3 server written with security primarily in mind" +arch=('i686' 'x86_64') +url="http://dovecot.org/" +license=("LGPL") +depends=('krb5' 'openssl' 'sqlite3>=3.7.5' 'libmysqlclient>=5.5.10' + 'postgresql-libs>=9.0.3' 'bzip2' 'expat' 'curl') +makedepends=('pam>=1.1.1' 'libcap>=2.19' 'libldap>=2.4.22') +optdepends=('libldap: ldap plugin') +provides=('imap-server' 'pop3-server') +options=('!libtool') +backup=(etc/dovecot/dovecot.conf + etc/dovecot/conf.d/{10-auth,10-director,10-logging,10-mail,10-master,10-ssl}.conf + etc/dovecot/conf.d/{15-lda,20-imap,20-lmtp,20-pop3}.conf + etc/dovecot/conf.d/{90-acl,90-plugin,90-quota}.conf + etc/dovecot/conf.d/auth-{checkpassword,deny,ldap,master,passwdfile,sql,static,system,vpopmail}.conf.ext + etc/ssl/dovecot-openssl.cnf) +install=$pkgname.install +source=(http://dovecot.org/releases/2.0/${pkgname}-${pkgver}.tar.gz dovecot.sh) +md5sums=('689e1a8863d4fb2fd252e1a6121dd181' + 'd020d43eab4ded6fb379dadc570a9490') + +build() { + cd ${srcdir}/$pkgname-$pkgver + + # configure with openssl, mysql, and postgresql support + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libexecdir=/usr/lib --with-moduledir=/usr/lib/dovecot/modules \ + --disable-static \ + --with-nss \ + --with-pam \ + --with-mysql \ + --with-pgsql \ + --with-sqlite \ + --with-ssl=openssl --with-ssldir=/etc/dovecot/ssl \ + --with-gssapi \ + --with-ldap=plugin \ + --with-zlib --with-bzlib \ + --with-libcap \ + --with-solr \ + --with-docs + make +} + +package() { + cd ${srcdir}/$pkgname-$pkgver + make DESTDIR=${pkgdir} install + + # install the launch script + install -D -m755 ${srcdir}/$pkgname.sh ${pkgdir}/etc/rc.d/$pkgname + + # install example conf files and ssl.conf + install -d -m755 ${pkgdir}/etc/dovecot/conf.d + install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/conf.d/*.conf ${pkgdir}/etc/dovecot/conf.d + install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/conf.d/*.conf.ext ${pkgdir}/etc/dovecot/conf.d + install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/dovecot.conf ${pkgdir}/etc/dovecot/ + install -d -m755 ${pkgdir}/etc/ssl + install -m 644 ${srcdir}/$pkgname-$pkgver/doc/dovecot-openssl.cnf ${pkgdir}/etc/ssl/ + + rm ${pkgdir}/etc/dovecot/README + + # install dovecot userdir - https://bugs.archlinux.org/task/20533 + install -d -m755 ${pkgdir}/var/run/dovecot/{login,empty} + chmod 755 ${pkgdir}/var/run/dovecot + chmod 750 ${pkgdir}/var/run/dovecot/login +} diff --git a/testing/dovecot/dovecot.install b/testing/dovecot/dovecot.install new file mode 100644 index 000000000..51d1509ee --- /dev/null +++ b/testing/dovecot/dovecot.install @@ -0,0 +1,57 @@ +# arg 1: the new package version +post_install() { + + # Make sure the group and user "dovecot"+"dovenull exists on this system and have the correct values + + # dovecot + if grep -q "^dovecot:" /etc/group &> /dev/null ; then + groupmod -g 76 -n dovecot dovecot &> /dev/null + else + groupadd -g 76 dovecot &> /dev/null + fi + + if grep -q "^dovecot:" /etc/passwd 2> /dev/null ; then + usermod -s /sbin/nologin -c "Dovecot user" -d /var/run/dovecot/login -u 76 -g dovecot dovecot &> /dev/null + else + useradd -s /sbin/nologin -c "Dovecot user" -d /var/run/dovecot/login -u 76 -g dovecot -m -r dovecot &> /dev/null + fi + + # dovenull + if grep -q "^dovenull:" /etc/group &> /dev/null ; then + groupmod -g 74 -n dovenull dovenull &> /dev/null + else + groupadd -g 74 dovenull &> /dev/null + fi + + if grep -q "^dovenull:" /etc/passwd 2> /dev/null ; then + usermod -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/run/dovecot/login -u 74 -g dovenull dovenull &> /dev/null + else + useradd -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/run/dovecot/login -u 74 -g dovenull -m -r dovenull &> /dev/null + fi + + # harden some permissions + chgrp dovenull /var/run/dovecot/login +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 + if [ "`vercmp $2 2.0.0`" -lt 0 ]; then + # important upgrade notice + echo "> IMPORTANT DOVECOT 2.0 UPGRADE NOTICE" + echo "> ------------------------------------" + echo "> see http://wiki2.dovecot.org/Upgrading/2.0" + echo "> make sure, you convert the dovecot.conf file" + fi + +} + +# arg 1: the old package version +pre_remove() { + userdel dovecot &> /dev/null + userdel dovenull &> /dev/null + groupdel dovecot &> /dev/null || /bin/true + groupdel dovenull &> /dev/null || /bin/true + rm -rf /var/run/dovecot/ &> /dev/null || /bin/true +} diff --git a/testing/dovecot/dovecot.sh b/testing/dovecot/dovecot.sh new file mode 100755 index 000000000..b7555fe50 --- /dev/null +++ b/testing/dovecot/dovecot.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/dovecot` +case "$1" in + start) + stat_busy "Starting Dovecot" + [ -z "$PID" ] && /usr/sbin/dovecot + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon dovecot + stat_done + fi + ;; + stop) + stat_busy "Stopping Dovecot" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon dovecot + stat_done + fi + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 -- cgit v1.2.3-54-g00ecf