3 # Description: post-install script for cyrus-imapd
4 # Contributor: Ryan Corder <ryanc@greengrey.org>
7 # arg 1: new package version
10 if [ -z "`grep '^cyrus:' /etc/passwd`" ]; then
11 useradd -d /var/spool/imap -g mail -s /bin/false cyrus
13 usermod -s /bin/false cyrus
16 # all kinds of directories needed for the IMAP spool
17 for subdir in imap/{,db,log,msg,proc,socket,sieve} spool/imap/{,stage.}; do
18 if [ ! -d /var/${subdir} ]; then
19 mkdir -m 0750 -p "/var/${subdir}"
22 for subdir in imap/{user,quota,sieve} spool/imap; do
23 for i in a b c d e f g h i j k l m n o p q r s t v u w x y z \
24 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
25 0 1 2 3 4 5 6 7 8 9; do
26 if [ ! -d /var/${subdir}/${i} ]; then
27 mkdir -m 0750 -p "/var/${subdir}/${i}"
31 chown -R cyrus:mail "/var/imap"
32 chown -R cyrus:mail "/var/spool/imap"
34 # make /var/imap/user/* and /var/imap/quota/* synchronous
35 if df -T /var/imap | grep -q ' ext[234] '; then
36 chattr +S /var/imap/{user,quota}{,/*}
38 # make /var/spool/imap/* synchronous
39 if df -T /var/spool/imap | grep -q ' ext[23] '; then
40 chattr +S /var/spool/imap{,/*}
43 # set more secure permissions on config files
44 chown -R cyrus:mail /etc/cyrus
45 chmod 600 /etc/cyrus/cyrus.conf
46 chmod 600 /etc/cyrus/imapd.conf
49 # arg 1: new package version
50 # arg 2: old package version
55 # arg 1: old package version
57 userdel cyrus &> /dev/null