chiark / gitweb /
install-rejectionreasons: new script
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 21 Jan 2014 17:12:42 +0000 (17:12 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 21 Jan 2014 17:12:42 +0000 (17:12 +0000)
install-rejectionreasons [new file with mode: 0755]
setup

diff --git a/install-rejectionreasons b/install-rejectionreasons
new file mode 100755 (executable)
index 0000000..39c41d9
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -e
+
+. ./get-settings
+
+in=$BASEDIR/stump/etc/messages
+out=$BASEDIR/public-html/rejection-reasons
+
+exec 3<$BASEDIR/webstump/config/newsgroups/$GROUP/rejection-reasons
+
+mkdir -p $out
+
+install_rr () {
+       rm -f "$out/$1"
+       file="$out/$1.txt"
+       exec 4>"$file.new"
+       printf >&4 "%s - %s\n\n" "$1" "$2"
+       cat >&4 "$in/$1"
+       mv -f "$file.new" "$file"
+       touch "$out/.want.$1.txt"
+}
+
+install_rr "charter" "not in accordance with the charter"
+
+while read line <&3; do
+       install_rr "${line%%::*}" "${line#*::}"
+done
+
+cd $out
+for was in *.txt; do
+       if ! test -f ".want.$was"; then
+               rm "$was"
+       fi
+done
diff --git a/setup b/setup
index bf605758f3b3bdc276c40e2349b54b094613bdbd..2e78fb1a2747495dd3479007763db811f2d54462 100755 (executable)
--- a/setup
+++ b/setup
@@ -15,6 +15,7 @@ x ./install-substitutions
 x make -C webstump
 x ./install-aggregates
 x ./install-weblinks
+x ./install-rejectionreasons
 x ./install-loggroups
 
 echo ==== DONE ====