[arch-commits] Commit in dovecot/trunk (PKGBUILD dovecot.install)

andyrtr at archlinux.org andyrtr at archlinux.org
Tue Aug 24 17:36:13 EDT 2010


    Date: Tuesday, August 24, 2010 @ 17:36:12
  Author: andyrtr
Revision: 88858

upgpkg: dovecot 2.0.1-1
new version 2.0.1; fix dovecot/dovenull user #20533

Modified:
  dovecot/trunk/PKGBUILD
  dovecot/trunk/dovecot.install

-----------------+
 PKGBUILD        |    4 ++--
 dovecot.install |   44 ++++++++++++++++++++++++++++++--------------
 2 files changed, 32 insertions(+), 16 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-08-24 21:33:31 UTC (rev 88857)
+++ PKGBUILD	2010-08-24 21:36:12 UTC (rev 88858)
@@ -6,7 +6,7 @@
 # Maintainer: Andreas Radke <andyrtr at archlinux.org>
 
 pkgname=dovecot
-pkgver=2.0.0
+pkgver=2.0.1
 pkgrel=1
 pkgdesc="An IMAP and POP3 server written with security primarily in mind"
 arch=('i686' 'x86_64')
@@ -28,7 +28,7 @@
 	etc/ssl/dovecot-openssl.cnf)
 install=$pkgname.install
 source=(http://dovecot.org/releases/2.0/${pkgname}-${pkgver}.tar.gz dovecot.sh)
-md5sums=('2ca3cbd523cac1cbd53a904255dcd4f8'
+md5sums=('f58749dae7826d82b96fccf2c9e3bbf7'
          'd020d43eab4ded6fb379dadc570a9490')
 
 build() {

Modified: dovecot.install
===================================================================
--- dovecot.install	2010-08-24 21:33:31 UTC (rev 88857)
+++ dovecot.install	2010-08-24 21:36:12 UTC (rev 88858)
@@ -1,17 +1,33 @@
 # arg 1:  the new package version
 post_install() {
-    if [ -z "`grep '^dovecot:' /etc/group`" ]; then
-	groupadd -g 76 dovecot >& /dev/null
-    fi
-    if [ -z "`grep '^dovenull:' /etc/group`" ]; then
-	groupadd -g 74 dovenull >& /dev/null
-    fi
-    if [ -z "`grep '^dovecot:' /etc/passwd`" ]; then
-	useradd -u 76 -d /var/run/dovecot/login -g dovecot -s /bin/false dovecot
-    fi
-    if [ -z "`grep '^dovenull:' /etc/passwd`" ]; then
-    	useradd -u 74 -d /var/run/dovenull/login -g dovecot -s /bin/false dovenull    
-    fi
+
+  # 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 
 }
 
 # arg 1:  the new package version
@@ -32,6 +48,6 @@
 pre_remove() {
     userdel dovecot &> /dev/null
     userdel dovenull &> /dev/null
-    groupdel dovecot &> /dev/null
-    groupdel dovenull &> /dev/null
+    groupdel dovecot &> /dev/null || /bin/true
+    groupdel dovenull &> /dev/null || /bin/true
 }



More information about the arch-commits mailing list