summaryrefslogtreecommitdiff
path: root/staging/dovecot/dovecot.install
diff options
context:
space:
mode:
authorroot <root@rshg047.dnsready.net>2011-05-01 22:33:26 +0000
committerroot <root@rshg047.dnsready.net>2011-05-01 22:33:26 +0000
commit40f0b1c7106cc1fed13f14e80f083ecd69c416f5 (patch)
treefaeb03af48db54c663f74f3f188b9c1c56ca6a0b /staging/dovecot/dovecot.install
parentc173ac862828a54925737fc1d90ede1dd09a312c (diff)
Sun May 1 22:33:26 UTC 2011
Diffstat (limited to 'staging/dovecot/dovecot.install')
-rw-r--r--staging/dovecot/dovecot.install57
1 files changed, 57 insertions, 0 deletions
diff --git a/staging/dovecot/dovecot.install b/staging/dovecot/dovecot.install
new file mode 100644
index 000000000..51d1509ee
--- /dev/null
+++ b/staging/dovecot/dovecot.install
@@ -0,0 +1,57 @@
+# arg 1: the new package version
+post_install() {
+
+ # 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
+
+ # harden some permissions
+ chgrp dovenull /var/run/dovecot/login
+}
+
+# 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
+
+}
+
+# arg 1: the old package version
+pre_remove() {
+ userdel dovecot &> /dev/null
+ userdel dovenull &> /dev/null
+ groupdel dovecot &> /dev/null || /bin/true
+ groupdel dovenull &> /dev/null || /bin/true
+ rm -rf /var/run/dovecot/ &> /dev/null || /bin/true
+}