Date: Tuesday, August 9, 2011 @ 13:31:55 Author: andyrtr Revision: 134967
upgpkg: dovecot 2.0.13-2 nuke /var/run stuff from package files, use /var/empty for login directory; use rc proto script from abs pkg for daemon control Modified: dovecot/trunk/PKGBUILD dovecot/trunk/dovecot.install dovecot/trunk/dovecot.sh -----------------+ PKGBUILD | 9 +---- dovecot.install | 18 ++++++---- dovecot.sh | 89 +++++++++++++++++++++++++++++++++++++----------------- 3 files changed, 74 insertions(+), 42 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2011-08-09 16:39:51 UTC (rev 134966) +++ PKGBUILD 2011-08-09 17:31:55 UTC (rev 134967) @@ -1,8 +1,8 @@ # $Id$ +# Maintainer: Andreas Radke <[email protected]> # Contributor: Paul Mattal <[email protected]> # Contributor: Federico Quagliata (quaqo) <[email protected]> # Contributor: GARETTE Emmanuel <gnunux at laposte dot net> -# Maintainer: Andreas Radke <[email protected]> pkgname=dovecot pkgver=2.0.13 @@ -26,7 +26,7 @@ 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 @@ 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 } Modified: dovecot.install =================================================================== --- dovecot.install 2011-08-09 16:39:51 UTC (rev 134966) +++ dovecot.install 2011-08-09 17:31:55 UTC (rev 134967) @@ -11,9 +11,9 @@ 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 @@ 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 @@ # 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 Modified: dovecot.sh =================================================================== --- dovecot.sh 2011-08-09 16:39:51 UTC (rev 134966) +++ dovecot.sh 2011-08-09 17:31:55 UTC (rev 134967) @@ -1,36 +1,69 @@ #!/bin/bash +daemon_name=dovecot + . /etc/rc.conf . /etc/rc.d/functions +#. /etc/conf.d/$daemon_name.conf -PID=`pidof -o %PPID /usr/sbin/dovecot` +get_pid() { + pidof -o %PPID $daemon_name +} + 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
