John Dennis 38f226
#!/bin/sh
John Dennis 38f226
IMAPCONF=/etc/imapd.conf
John Dennis 38f226
John Dennis 38f226
CONFDIR=$(grep -se "^configdirectory:" $IMAPCONF | cut -d":" -f2)
John Dennis 38f226
if [ "x$CONFDIR" = "x" ]; then
John Dennis 38f226
  echo "$0 error: configdirectory not found in /etc/imapd.conf, exiting!"
John Dennis 38f226
  exit 1
John Dennis 38f226
fi
John Dennis 38f226
John Dennis 38f226
find $CONFDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
John Dennis 9e566a
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
John Dennis 38f226
  if [ "x$SPOOLDIR" = "x" ]; then
John Dennis 9e566a
    echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
John Dennis 38f226
  else
John Dennis 38f226
    find $SPOOLDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
John Dennis 38f226
  fi
John Dennis 38f226
done
John Dennis 38f226
John Dennis 38f226
find $CONFDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
John Dennis 9e566a
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
John Dennis 38f226
  if [ "x$SPOOLDIR" = "x" ]; then
John Dennis 9e566a
    echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
John Dennis 38f226
  else
John Dennis 38f226
    find $SPOOLDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
John Dennis 38f226
  fi
John Dennis 38f226
done
John Dennis 38f226
John Dennis 38f226
# lmtp socket must be accessible by group mail
John Dennis 38f226
chmod 750 $CONFDIR
John Dennis 38f226
chmod 750 ${CONFDIR}/socket