#!/bin/sh # Written by Jake Vickers (jake@v2gnu.com) on 06/25/07 # Removes Rules Du Jour if it was previously installed, and installs sa-update # to take it's place. Also installs openprotect's update channel, which includes # almost all of the files that used to be updated by RDJ. # Lastly, installs a cron job to keep everythig up to date. # 07/06/07 - Jake - Added a check to remove the /etc/mail/spamassassin/RuleduJour dir. # Also added a de-lint routine - forgot to reload SA since we added new rules. # Lastly, refactored the cron job to be compliant with the rest of QTP. DAILYCRON=/etc/cron.daily/qtp-sa-update ORIG=`pwd` qtp=/opt/qmailtoaster-plus cron_loc=/etc/cron.daily if [ -f $DAILYCRON ] ; then echo "Already installed! Exiting." sleep 2 exit 0 fi echo "It is recommended that if you had RDJ rules previously installed," echo "you go to /etc/mail/spamassassin and remove them." echo "the OpenProtect channel will provide you with the same rules, so" echo "there is no need to load them twice and use cycles." echo "" echo "Hit enter to continue" read $YEP echo "Running sa-update initialize everything" sa-update echo "Removing RDJ if it was previously installed" if [ -d /etc/rulesdujour ] ; then echo "Removing Rules du Jour (1)" rm -rf /etc/rulesdujour fi if [ -f /usr/local/sbin/rules_du_jour ] ; then echo "Removing Rules du Jour (2)" rm -rf /usr/local/sbin/rules_du_jour fi if [ -d /etc/mail/spamassassin/RuleduJour ] ; then echo "Removing Rules du Jour (3)" rm -rf /etc/mail/spamassassin/RuleduJour fi if [ -f /etc/cron.daily/rules_du_jour ] ; then echo "Removing Rules du Jour cron job" rm -rf /etc/cron.daily/rules_du_jour fi if [ -f /etc/cron.weekly/rules_du_jour ] ; then echo "Removing Rules du Jour cron job" rm -rf /etc/cron.weekly/rules_du_jour fi echo "Installing openprotect.com's GPG key" cd /tmp wget http://saupdates.openprotect.com/pub.gpg sa-update --import pub.gpg rm -rf pub.gpg echo "Doing a full download, including Spamassassin's update channel and the SARE rules" sa-update --gpgkey D1C035168C1EBC08464946DA258CDB3ABDE9DC10 --channel saupdates.openprotect.com --channel updates.spamassassin.org echo "Installing sa-update as a daily cron job." echo "Please adjust $cron_loc if you want to add any additional" echo "channels or whatever." cp $qtp/etc/cron.daily/qtp-sa-update $cron_loc/ chmod +x $DAILYCRON echo "Running spamassassin --lint." spamassassin --lint echo "Restarting spamd...." svc -d /var/qmail/supervise/spamd /var/qmail/supervise/spamd/log svc -t /var/qmail/supervise/spamd /var/qmail/supervise/spamd/log svc -u /var/qmail/supervise/spamd /var/qmail/supervise/spamd/log sleep 2 echo svstat /var/qmail/supervise/spamd svstat /var/qmail/supervise/spamd/log echo "" echo "All done." sleep 3 cd $ORIG exit 0