One important principle in software engineering is DRY – Don’t Repeat Yourself. This can of course also be applied on tasks a system administrator has to do over and over again. One of this tasks for me was recently to have a working dovecot installation with sieve support.
Unfortunately the authors of dovecot and its sieve plugin decided to make the process of getting there not quite easy, but at least straight forward enough to automate it. I’d still rather like to use some packaged debs, but I could not find any (of course stock Debian Lenny debs do not support it), but for now the process for me is as easy as picking up the new version strings, edit the following script and hit run. I hope its useful for somebody else:
#!/bin/bash
DOVECOT_VERSION=1.2.3
SIEVE_VERSION=0.1.11
MANAGESIEVE_VERSION=0.11.8
BUILDDIR=”$(dirname $(readlink -f $0))/build”
rm -rf $BUILDDIR
mkdir $BUILDDIR
cd $BUILDDIR
#
# step 1: fetch dovecot, patch it with managesieve and build it
#
echo “fetching, patching, building and installing dovecot-$DOVECOT_VERSION”
wget -qO – “http://www.dovecot.org/releases/${DOVECOT_VERSION:0:3}/dovecot-$DOVECOT_VERSION.tar.gz” |
tar -xzf –
cd dovecot-$DOVECOT_VERSION
wget -qO – “http://www.rename-it.nl/dovecot/${DOVECOT_VERSION:0:3}/dovecot-$DOVECOT_VERSION-managesieve-$MANAGESIEVE_VERSION.diff.gz” |
gzip -dc | patch -p1 >/dev/null
./configure –enable-header-install >>$BUILDDIR/build.log
make install >>$BUILDDIR/build.log
cd $BUILDDIR
#
# step 2: fetch and build dovecot-sieve
#
echo “fetching, building and installing dovecot-sieve-$SIEVE_VERSION”
wget -qO – “http://www.rename-it.nl/dovecot/${DOVECOT_VERSION:0:3}/dovecot-${DOVECOT_VERSION:0:3}-sieve-$SIEVE_VERSION.tar.gz” |
tar -xzf –
cd dovecot-${DOVECOT_VERSION:0:3}-sieve-$SIEVE_VERSION
./configure –with-dovecot=$BUILDDIR/dovecot-$DOVECOT_VERSION >>$BUILDDIR/build.log
make install >>$BUILDDIR/build.log
cd $BUILDDIR
#
# step 3: fetch and build dovecot-managesieve
#
echo “fetching, building and installing dovecot-managesieve-$MANAGESIEVE_VERSION”
wget -qO – “http://www.rename-it.nl/dovecot/${DOVECOT_VERSION:0:3}/dovecot-${DOVECOT_VERSION:0:3}-managesieve-$MANAGESIEVE_VERSION.tar.gz” |
tar -xzf –
cd dovecot-${DOVECOT_VERSION:0:3}-managesieve-$MANAGESIEVE_VERSION
./configure –with-dovecot=$BUILDDIR/dovecot-$DOVECOT_VERSION \
–with-dovecot-sieve=$BUILDDIR/dovecot-${DOVECOT_VERSION:0:3}-sieve-$SIEVE_VERSION >>$BUILDDIR/build.log
make install >>$BUILDDIR/build.log
cd $BUILDDIR
echo “all done – build log is available in $BUILDDIR/build.log”