#!/bin/sh umask 002 srcdir=`pwd` tmpdir=$srcdir/tmp/rulesdir.$$ rm -rf $tmpdir; mkdir -p $tmpdir || exit $? PERL=${PERL:-perl} RELDIR=$HOME/public_html/devel mkdir -p $RELDIR DISTNAME=Mail-SpamAssassin-rules echo 'Making SpamAssassin'; make || perl Makefile.PL < /dev/null || exit $? make || exit $? make version.env || exit $? . ./version.env # "3.1.0-pre2-r202405" should appear as "3.1.0-pre2" after this VERSION=`echo $FULL_VERSION | perl -pe 's/-(r\d+)$//'` SVNVER=`svn info | perl -ne '/Revision: (\d+)/ and print $1'` DISTVNAME=$DISTNAME-$VERSION.r$SVNVER DISTVBASE=$DISTNAME-$VERSION # remove the rules files for rules we won't be shipping rm -f rules/70_*.cf # remove new features, unsupported in existing code in the field # (TODO: need a better way to exclude files that require new features # like this; judicious use of "ifplugin" helps) # rm rules/60_somerandomfeature.cf # and ensure the ruleset lints! echo 'Linting the rules...' ./spamassassin --lint || exit $? rulesdir=rules echo 'Tarring the rules...' ( cd $rulesdir # Use this to include plugin .pm files: # tar cvf - *.cf *.pm || exit $? # or this, to ban code from the rules: tar cvf - [0-9]*.cf || exit $? ) | gzip -9 > $tmpdir/rules.tgz || exit $? echo 'Make sure rules file is not empty...' # ensure non-empty [ -s $tmpdir/rules.tgz ] || exit 3 echo 'Testing the rules file archive integrity...' linttmp=$tmpdir/lintdir rm -rf $linttmp mkdir $linttmp ( cd $linttmp # check validity of tarball; also extract gunzip -cd < $tmpdir/rules.tgz | tar xf - || exit $? ) sitetmp=$tmpdir/sitetmp rm -rf $sitetmp mkdir $sitetmp cp rules/*.pre $sitetmp # now, ensure the ruleset (entirely as distributed) lints, also. # use "-p /dev/null" so any user_prefs data is ignored. echo 'Checking the distributed ruleset will lint...' ./spamassassin -x --configpath=$linttmp --siteconfigpath=$sitetmp \ -p /dev/null --lint \ || exit $? # sign and get sums rm -f $tmpdir/rules.*.asc #Adding information to run gpg-agent so a non-privileged user can sign - There should be a check to see if this is done gpg-agent --homedir $HOME/sabuildtools/rulessigningkey --daemon --write-env-file "${HOME}/sabuildtools/rulessigningkey/.gpg-agent-info" #for ext in tar.bz2 tar.gz zip ; do # cp $DISTVNAME.$ext $RELDIR # # perl build/sha256sum.pl $DISTVNAME.$ext > $RELDIR/$DISTVNAME.$ext.sha256 || exit $? # perl build/sha512sum.pl $DISTVNAME.$ext > $RELDIR/$DISTVNAME.$ext.sha512 || exit $? # # rm -f $DISTVNAME.$ext.asc* if [ -d $HOME/sabuildtools/rulessigningkey ]; then gpg --homedir $HOME/sabuildtools/rulessigningkey --detach-sign --sign --armor < $tmpdir/rules.tgz > $tmpdir/rules.tgz.asc || exit $? #mv $DISTVNAME.$ext.asc $RELDIR/$DISTVNAME.$ext.asc || exit $? fi #rm -f $DISTVNAME.$ext done #gpg --homedir /home/updatesd/key -bsa - \ # < $tmpdir/rules.tgz > $tmpdir/rules.tgz.asc || exit $? ( cd $tmpdir ln rules.tgz $DISTVNAME.tgz $PERL $srcdir/build/md5sum.pl $DISTVNAME.tgz > rules.tgz.md5 || exit $? $PERL $srcdir/build/sha1sum.pl $DISTVNAME.tgz > rules.tgz.sha1 || exit $? ) for ext in tgz tgz.md5 tgz.sha1 tgz.asc ; do rm -f $RELDIR/$DISTVBASE.*.$ext if [ -f $tmpdir/rules.$ext ] ; then mv $tmpdir/rules.$ext $RELDIR/$DISTVNAME.$ext ls -l $RELDIR/$DISTVNAME.$ext fi done chgrp -R spamassassin $RELDIR rm -rf $tmpdir