3 # This command updates the spamassassin configuration; tests the new
4 # configuration; then moves the updated configuration in place
12 if [ "$HOSTNAME" = "rietz" ]; then
13 BASEDIR="/org/bugs.debian.org"
14 USERCONF="bugs/user_prefs";
15 elif [ "$HOSTNAME" = "liszt" ]; then
16 BASEDIR="/var/list/.etc";
17 USERCONF="lists/user_prefs";
19 echo "Unknown hostname '$HOSTNAME'";
23 SACONFIG="$BASEDIR/spamassassin_config";
24 BAKDIR="$BASEDIR/spamassassin_config_bak";
26 # figure out if there's an update to be made
27 ORIGREV=$(svn info $SACONFIG |awk '/^Revision:/{print $2}')
28 NEWREV=$(svn info $(svn info $SACONFIG|awk '/^URL:/{print $2}')|awk '/^Revision:/{print $2}')
30 # no changes, bug out.
31 if [ "0$ORIGREV" -ge "0$NEWREV" ]; then
35 if [ -e "$SACONFIG/.update_spamassassin" ] && kill -0 $(cat "$SACONFIG/.update_spamassassin") >/dev/null 2>&1; then
36 echo "Another update_spamassassin appears to be running"
39 echo $$ > "$SACONFIG/.update_spamassassin";
42 function remove_pidfile(){
43 rm "$SACONFIG/.update_spamassassin";
46 trap remove_pidfile ERR;
49 function report_failure(){
50 # Hrm; a previous update failed; don't report again until the file
52 if [ -e "$SACONFIG/failed_update" ]; then
55 echo "$FAILUREMESSAGE" >> "$SACONFIG/failed_update"
56 echo "$FAILUREMESSAGE";
59 Update_spamassassin will not report any additional errors until this
62 Please fix the problem and then remove
63 $SACONFIG/failed_update
68 cp -ar $SACONFIG $TMPDIR/.
69 cd $TMPDIR/spamassassin_config;
70 svn update -q --non-interactive;
71 if svn status |grep -q '^C'; then
72 FAILUREMESSAGE=$'The following conflicts were found\n\n'
73 FAILUREMESSAGE="$FAILUREMESSAGE$(svn status|grep ^C)";
78 if ! spamassassin -p $TMPDIR/spamassassin_config/$USERCONF --lint > $TMPDIR/sa_lint 2>&1; then
79 FAILUREMESSAGE="$(echo -e 'spamassassin -p $TMPDIR/spamassassin_config/$USERCONF --lint\nfailed with\n'| cat - $TMPDIR/sa_lint)";
82 mv "$SACONFIG" "$BAKDIR/spamassassin_config_r$ORIGREV"
83 mv "$TMPDIR/spamassassin_config" "$SACONFIG"
88 if [ "$HOSTNAME" == "rietz" ]; then
89 touch /home/debbugs/.spamassassin/user_prefs
90 elif [ "$HOSTNAME" == "liszt" ]; then
94 echo "Unknown hostname '$HOSTNAME'";