#!/bin/bash # revert-stable-update # script to revert sa-update stable updates to an existing version # for use in an emergency to revert rule updates after the release # of a bad rule update # # note: this is just a wrapper to call mkupdate-with-scores with the # proper parameters to do the reversion # mkupdate-with-scores does the reversion because the update needs # to be tested to work with each of the stable .x versions and each # .x version's DNS needs to be updated accordingly # # USAGE: # # 1. Decide that there's a need to revert to a previous update that # is generally known to be good. # # 2. Login to spamassassin.zones.apache.org # # 3. sudo su - updatesd # # 4. /home/updatesd/svn/mkupdates-with-scores/revert-stable-update 1234567 # # The script will copy the supplied update version 1234567 to a new # update version in order that it will superseed the current update. # It will then test that it works with each stable .x version and # then update DNS records accordingly. A cron job will be set to # update DNS in 16 minutes after completion of testing to give the # mirrors time to update. . /etc/profile PATH=/home/jm/sabuildtools/bin:$PATH cd /home/updatesd/svn/mkupdates-with-scores set -e umask 022 UPDATEDIR=/var/www/buildbot.spamassassin.org/updatestage if [ ! $1 ]; then echo "Stable updates from the last 60 days" find $UPDATEDIR -name '*.gz' -perm 0544 -mtime -60 -exec ls -l {} \; echo "Additional older updates available:" find $UPDATEDIR -name '*.gz' -perm 0544 -mtime +60 -exec ls -l {} \; | wc -l echo "" echo "Usage: ./revert-stable-update 1234567" fi if [ ! -f $UPDATEDIR/$1.tar.gz -a ! -f $UPDATEDIR/$1.tar.gz.asc -a ! -f $UPDATEDIR/$1.tar.gz.sha1 ]; then echo "Could not find update files for update revision $1" fi if [ $2 ]; then TWO=$2 else TWO=0 fi if [ $3 ]; then THREE=$3 else THREE=0 fi if [ $4 ]; then FOUR=$4 else FOUR=0 fi ./mkupdate-with-scores $TWO $THREE $FOUR $1