From e81c6fe4fb38144709923b2da3ab68a01712a26b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Aug 2011 23:14:36 +0000 Subject: Wed Aug 10 23:14:35 UTC 2011 --- extra/dovecot/PKGBUILD | 13 ++----- extra/dovecot/dovecot.install | 18 +++++---- extra/dovecot/dovecot.sh | 89 +++++++++++++++++++++++++++++-------------- 3 files changed, 76 insertions(+), 44 deletions(-) (limited to 'extra/dovecot') diff --git a/extra/dovecot/PKGBUILD b/extra/dovecot/PKGBUILD index 8d3718c07..fbbc8dff7 100644 --- a/extra/dovecot/PKGBUILD +++ b/extra/dovecot/PKGBUILD @@ -1,12 +1,12 @@ -# $Id: PKGBUILD 123590 2011-05-11 17:20:39Z andyrtr $ +# $Id: PKGBUILD 134967 2011-08-09 17:31:55Z andyrtr $ +# Maintainer: Andreas Radke # Contributor: Paul Mattal # Contributor: Federico Quagliata (quaqo) # Contributor: GARETTE Emmanuel -# Maintainer: Andreas Radke pkgname=dovecot pkgver=2.0.13 -pkgrel=1 +pkgrel=2 pkgdesc="An IMAP and POP3 server written with security primarily in mind" arch=('i686' 'x86_64') url="http://dovecot.org/" @@ -26,7 +26,7 @@ backup=(etc/dovecot/dovecot.conf install=$pkgname.install source=(http://dovecot.org/releases/2.0/${pkgname}-${pkgver}.tar.gz dovecot.sh) md5sums=('fd8a0702275a61332db7353dadff0f92' - 'd020d43eab4ded6fb379dadc570a9490') + '587159e84e2da6f83d70b3c706ba87cc') build() { cd ${srcdir}/$pkgname-$pkgver @@ -66,9 +66,4 @@ package() { 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/extra/dovecot/dovecot.install b/extra/dovecot/dovecot.install index 51d1509ee..ddec178a4 100644 --- a/extra/dovecot/dovecot.install +++ b/extra/dovecot/dovecot.install @@ -11,9 +11,9 @@ post_install() { 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 + usermod -s /sbin/nologin -c "Dovecot user" -d /var/empty -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 + useradd -s /sbin/nologin -c "Dovecot user" -d /var/empty -u 76 -g dovecot -r dovecot &> /dev/null fi # dovenull @@ -24,9 +24,9 @@ post_install() { 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 + usermod -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/empty -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 + useradd -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/empty -u 74 -g dovenull -r dovenull &> /dev/null fi # harden some permissions @@ -36,15 +36,19 @@ post_install() { # 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 - + fi + if [ "`vercmp $2 2.0.13-2`" -lt 0 ]; then + # to remove no more existant usersdirs simply remove the dovecot users and let them recreate later + userdel dovecot &> /dev/null + userdel dovenull &> /dev/null + fi + post_install $1 } # arg 1: the old package version diff --git a/extra/dovecot/dovecot.sh b/extra/dovecot/dovecot.sh index b7555fe50..e8966bd55 100755 --- a/extra/dovecot/dovecot.sh +++ b/extra/dovecot/dovecot.sh @@ -1,36 +1,69 @@ #!/bin/bash +daemon_name=dovecot + . /etc/rc.conf . /etc/rc.d/functions +#. /etc/conf.d/$daemon_name.conf + +get_pid() { + pidof -o %PPID $daemon_name +} -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}" + start) + stat_busy "Starting $daemon_name daemon" + + PID=$(get_pid) + if [[ -z $PID ]]; then + [[ -f /var/run/$daemon_name.pid ]] && + rm -f /var/run/$daemon_name.pid + # RUN + $daemon_name + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + echo $(get_pid) > /var/run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + # KILL + [[ -n $PID ]] && kill $PID &> /dev/null + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + rm -f /var/run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" esac + exit 0 -- cgit v1.2.3-54-g00ecf