#!/bin/sh # 2001-07-19 Rafael Skodlar # Install exim server. Sendmail, if exists is disabled, it's binaries are moved # on the side and replaced with links to exim binary. EXIM_DIR=/usr/local/exim EXIM_CONFIG=/etc/exim EXIM_RC=/etc/init.d/exim EXIM_BIN="exim eximon eximon.bin exim_dumpdb exim_fixdb exim_tidydb exinext exiwhat exim_dbmbuild exicyclog exigrep eximstats exiqsumm exim_lock" TIME=`date '+%Y%m%d_%H%M'` TAR_DIR=/tmp/exim EXIM_LOG_DIR=/var/log/exim SENDMAIL_RC=/etc/init.d/sendmail if [ -d "${EXIM_DIR}/backup" ]; then cd ${EXIM_DIR} tar cvfp backup/exim_${TIME}.tar --exclude backup . else [ ! -d "${EXIM_DIR}/bin" ] && mkdir -p ${EXIM_DIR}/bin [ ! -d "${EXIM_DIR}/backup" ] && mkdir ${EXIM_DIR}/backup [ ! -d "${EXIM_CONFIG}" ] && mkdir $EXIM_CONFIG [ ! -d "$EXIM_LOG_DIR" ] && mkdir $EXIM_LOG_DIR fi function install() { cd $TAR_DIR echo -e "installing:\n-----------------------------------------------\n" cp $EXIM_BIN ${EXIM_DIR}/bin chown root ${EXIM_DIR}/bin/exim chmod a+x ${EXIM_DIR}/bin/exim chmod u+s ${EXIM_DIR}/bin/exim } if [ -e "$EXIM_RC" ]; then $EXIM_RC stop install elif [ ! -e "$EXIM_RC" ]; then cd $TAR_DIR cp rc.exim /etc/rc.d/init.d/exim chkconfig --level 235 exim on # [ ! -e "/etc/rc3.d/S80exim" ] && (cd /etc/rc3.d; ln -s ../init.d/exim S80exim) USER=`grep exim /etc/passwd | awk -F: '{print $1};' | head -1` if [ -z "$USER" ]; then echo -e "Make sure there is exim user and group on your system.\n Suggested UID: 47, GID: 47\nRun the following command to create exim account in Linux:\n" echo -e "useradd -c MTA Exim -d /var/spool/exim -u 47 -g 47 -s /bin/false exim" echo -e "After that execute\nchown exim.exim /var/log/exim" fi if [ ! -e "${EXIM_CONFIG}/exim.conf" ]; then cat << EOM Installing default configuration in /etc/exim/exim.conf because there is no existing configuration file. EOM cp exim.conf ${EXIM_CONFIG}/exim.conf else cp ${EXIM_CONFIG}/exim.conf ${EXIM_CONFIG}/exim.conf.$TIME echo "Saved previous configuration to: ${EXIM_CONFIG}/exim.conf.$TIME" cp exim.conf ${EXIM_CONFIG}/exim.conf fi fi # Remove Sendmail and create links to Exim in it's place # It's assumed that binaries exist when sendmail startup script exists if [ -e "$SENDMAIL_RC" ];then chkconfig --level 235 sendmail off mv /etc/init.d/sendmail /etc/init.d/sendmail.disabled echo "Disabled Sendmail in run levels 2, 3, and 5." echo "Moving Sendmail binaries and creating links to exim in it's place." cd /usr/sbin mv sendmail sendmail.pre-exim ln -s ../local/exim/bin/exim sendmail cd /usr/lib mv sendmail sendmail.pre-exim ln -s ../local/exim/bin/exim sendmail cd /usr/bin mv /usr/bin/newaliases /usr/bin/newaliases.pre-exim ln -s ../local/exim/bin/exim newaliases mv /usr/bin/mailq /usr/bin/mailq.pre-exim ln -s ../local/exim/bin/exim mailq fi # EOS