Updating reports....

James Gray james at grayonline.id.au
Tue Mar 30 04:39:52 IST 2004


Maybe I've just reinvented the wheel but I was in a hurry :P  Anyway I
needed to quickly update all the reports we've customised in MS 4.26 so the
new version (4.28) "looked" the same to our users.

The solution I just hacked basically "diff"'s all the txt/html files in the
4.26 reports directory against the same file in the new version.  I thought
this hack might be useful to others, so here it is:

(Is there a better way?!?)

#!/usr/local/bin/bash

OLDDIR=/opt/MailScanner/etc/reports/en
NEWDIR=/opt/MailScanner-4.28.6/etc/reports/en

# Check source and destination directories:
if [ -d $OLDDIR/ ];
        then
                echo "Found $OLDDIR - continuing...";
        else
                echo "Cant find $OLDDIR - exiting!"
                exit 0;
fi

if [ -d $NEWDIR/ ];
        then
                echo "Found $NEWDIR - continuing...";
        else
                echo "Cant find $NEWIDR - exiting!"
                exit 0;
fi

for FILE in `ls $OLDDIR/*.{html,txt}`
do
        FOO=`echo $FILE|awk -F/ '{print $NF}'`
        if [ -e $NEWDIR/$FOO ]; then
                echo "Patching $FOO"
                diff $NEWDIR/$FOO $OLDDIR/$FOO > $NEWDIR/$FOO.diff
                patch $NEWDIR/$FOO $NEWDIR/$FOO.diff
                echo "";
        fi
done

James
--
Fortune cookies says:
Men are those creatures with two legs and eight hands.
                -- Jayne Mansfield



More information about the MailScanner mailing list