chiark / gitweb /
probes: probe script can probe
[modbot-mtm.git] / install-rejectionreasons
1 #!/bin/bash
2 set -e
3
4 . ./get-settings
5
6 in=$BASEDIR/stump/etc/messages
7 out=$BASEDIR/public-html/rejection-reasons
8
9 exec 3<$BASEDIR/webstump/config/newsgroups/$GROUP/rejection-reasons
10
11 mkdir -p $out
12
13 install_rr () {
14         rm -f "$out/$1"
15         file="$out/$1.txt"
16         exec 4>"$file.new"
17         printf >&4 "%s - %s\n\n" "$1" "$2"
18         cat >&4 "$in/$1"
19         mv -f "$file.new" "$file"
20         touch "$out/.want.$1.txt"
21 }
22
23 install_rr "charter" "not in accordance with the charter"
24
25 while read line <&3; do
26         install_rr "${line%%::*}" "${line#*::}"
27 done
28
29 cd $out
30 for was in *.txt; do
31         if ! test -f ".want.$was"; then
32                 rm "$was"
33         fi
34 done