You are not logged in.

#1 2004-11-11 17:25:02

quaqo
Member
Registered: 2004-11-11
Posts: 53

[new] dovecot

Dovecot is an IMAP and POP3 server with support to SSL. It's much easyier to configure than others and is really fast.

PKGBUILD

# Contributor: Federico Quagliata (quaqo) <quaqo@despammed.com>

pkgname=dovecot
pkgver=0.99.11
pkgrel=2
pkgdesc="An IMAP and POP3 server written with security primarily in mind"
url="http://www.dovecot.org"
license="LGPL"
depends=('openssl' 'pam')
conflicts=('imap-server' 'pop3-server')
provides=('imap-server' 'pop3-server')
backup=(etc/dovecot.conf)
install=dovecot.install
source=(http://dovecot.org/releases/$pkgname-$pkgver.tar.gz dovecot dovecot-example.conf)
md5sums=('05090ad784540b96c84f32080ada9f97' '4cf15ae6449b77c816cc1a68ba47d8ce' 'd852f2d105768d8e2aada6c7b7e5227a')

build() {
  cd $startdir/src/$pkgname-$pkgver
  ./configure 
    --prefix=/usr 
    --sysconfdir=/etc 
    --with-ssl=openssl
  make || return 1

  make prefix=$startdir/pkg/usr install

  mkdir -p $startdir/pkg/etc/rc.d
  mkdir -p $startdir/pkg/etc/dovecot
  cp $startdir/src/dovecot $startdir/pkg/etc/rc.d
  sed -ie 's/imapd.pem/dovecot.pem/g' $startdir/src/$pkgname-$pkgver/doc/mkcert.sh
  cp $startdir/src/$pkgname-$pkgver/doc/mkcert.sh $startdir/pkg/etc/dovecot
  cp $startdir/src/$pkgname-$pkgver/doc/dovecot-openssl.cnf $startdir/pkg/etc/dovecot
  cp $startdir/src/dovecot-example.conf $startdir/pkg/etc/
  rm /etc/dovecot-example.conf
}

dovecot.install

# arg 1:  the new package version

post_install() {
  groupadd -g 97 dovecot &>/dev/null
  useradd -u 97 -g dovecot -d /dev/null -s /bin/false dovecot &>/dev/null
  cd /etc/dovecot/
  [ -e /etc/ssl/certs/dovecot.pem -a -e /etc/ssl/private/dovecot.pem ] 
            || sh /etc/dovecot/mkcert.sh
  /bin/true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  post_install $1
  /bin/true
}

# arg 1:  the old package version
pre_remove() {
  userdel dovecot &>/dev/null
  groupdel dovecot &>/dev/null
  /bin/true
}

op=$1
shift
$op $*

dovecot rc.d script

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID /usr/sbin/dovecot`

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
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    sleep 2
    start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac
exit 0

Tips & corrections here or to quaqo@despammed.com.

Greetings,
Federico (quaqo)
--
http://quaqo.altervista.org

Offline

Board footer

Powered by FluxBB