#!/bin/bash
PM=`perl -MConfig -e 'print
"$Config{installsitelib}"'`/Mail/SpamAssassin/Plugin/PDFInfo.pm
CF=/etc/mail/spamassassin/PDFInfo.cf
cp $PM $PM.bak || exit 1 # Probably I am not root...
cp $CF $CF.bak || exit 1 # same
echo Downloading, veryfying perl module and size of config file...
if wget -q -O $PM http://www.rulesemporium.com/plugins/PDFInfo.pm
\
&& wget -q -O $CF http://www.rulesemporium.com/plugins/pdfinfo.cf
\
&& perl -MMail::SpamAssassin::Plugin::PDFInfo -e print "Perl Module PDFInfo
OK\n" \
&& test -s $CF ; then
echo Successfully downloaded $PM and $CF:
chmod 644 $PM $CF
ls -l $PM $CF
rm $CF.bak $PM.bak
echo Restarting SpamAssassin:
service spamassassin restart
exit 0
else
echo FAILED to download $PM and $CF
mv $CF.bak $CF
mv $PM.bak $PM
exit 1
fi