2 # This script performs postoffice updates.
6 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
9 if [ -d /var/athena ] && [ -w /var/athena ]; then
10 exec >/var/athena/moira_update.log 2>&1
12 exec >/tmp/moira_update.log 2>&1
15 # The following exit codes are defined and MUST BE CONSISTENT with the
16 # error codes the library uses:
18 MR_MISSINGFILE=47836473
24 TARFILE=/var/tmp/po.out
25 SRC_DIR=/var/tmp/po.dir
26 IMAP_ROOT=/usr/local/cyrus
27 IMAP_CONFIG=${IMAP_ROOT}/config
28 IMAP_CHECK=${IMAP_CONFIG}/ignore_update_checks
29 IMAP_MBOXES=${IMAP_CONFIG}/mailboxes.input;
30 IMAP_QUOTA=${IMAP_CONFIG}/quota
31 IMAP_QINPUT=${IMAP_QUOTA}/input
32 IMAP_BIN=${IMAP_ROOT}/bin
39 if [ ! -r ${TARFILE} ]; then
47 uchost=`hostname | tr '[a-z]' '[A-Z]'`
48 echo $uchost | egrep -e "\." > /dev/null
50 domain=`grep domain /etc/resolv.conf | awk '{print $2}' |tr '[a-z]' '[A-Z]'`
52 uchost=$uchost.$domain
61 if [ ! -d $uchost ]; then
62 echo "no directory for "$uchost
63 exit ${MR_MISSINGFILE}
73 cp mailboxes ${IMAP_MBOXES}
75 echo "failed to copy mailboxes"
79 if [ -r {$IMAP_MBOXES} ]; then
80 egrep "\..*\." ${IMAP_CONFIG}/mailboxes >> ${IMAP_MBOXES}
83 sort -o ${IMAP_MBOXES} ${IMAP_MBOXES}
91 cp quota ${IMAP_QINPUT}
93 echo "failed to copy quota"
101 cp ${IMAP_CONFIG}/mailboxes ${IMAP_CONFIG}/mailboxes.save
106 LD_LIBRARY_PATH=/usr/local/tcl/lib
107 export LD_LIBRARY_PATH
109 ${IMAP_BIN}/cyradm -file ${IMAP_BIN}/sync.cyradm sync -d
117 cp ${IMAP_CONFIG}/mailboxes ${IMAP_CONFIG}/mailboxes.backup
123 if [ -f ${TARFILE} ]; then
127 if [ -d ${SRC_DIR} ]; then