1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
#! /bin/sh
# fixscript will replace this line with code to load innshellvars
## $Revision: 7743 $
## Script to execute checkgroups text; results to stdout.
T=${TMPDIR}
cat /dev/null >${T}/$$out
## Copy the article without headers, append local newsgroups.
cat >${T}/$$msg
test -f ${LOCALGROUPS} && cat ${LOCALGROUPS} >>${T}/$$msg
## Get the top-level newsgroup names from the message and turn it into
## an egrep pattern.
PATS=`${SED} <${T}/$$msg \
-e 's/[ ].*//' -e 's/\..*//' \
-e 's/^!//' -e '/^$/d' \
-e 's/^/^/' -e 's/$/[. ]/' \
| sort -u \
| (tr '\012' '|' ; echo '' )\
| ${SED} -e 's/|$//'`
${EGREP} "${PATS}" ${ACTIVE} | ${EGREP} "${1:-.}" | ${SED} 's/ .*//' | sort >${T}/$$active
${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/[ ].*//' | sort >${T}/$$newsgrps
comm -13 ${T}/$$active ${T}/$$newsgrps >${T}/$$missing
comm -23 ${T}/$$active ${T}/$$newsgrps >${T}/$$remove
${EGREP} "${PATS}" ${ACTIVE} | ${EGREP} "${1:-.}" | ${SED} -n '/ m$/s/ .*//p' | sort >${T}/$$amod.all
${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/\r\?$//' |
${SED} -n '/(Moderated)$/s/[ ].*//p' | sort >${T}/$$ng.mod
comm -12 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.mod
comm -23 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.unmod
cat ${T}/$$add.mod ${T}/$$add.unmod >>${T}/$$add
comm -23 ${T}/$$amod.all ${T}/$$remove >${T}/$$amod
comm -13 ${T}/$$ng.mod ${T}/$$amod >${T}/$$ismod
comm -23 ${T}/$$ng.mod ${T}/$$amod >${T}/$$nm.all
comm -23 ${T}/$$nm.all ${T}/$$add >${T}/$$notmod
${EGREP} "${PATS}" ${NEWSGROUPS} | ${EGREP} "${1:-.}" | ${SED} 's/[ ]\+/ /' | sort >${T}/$$localdesc
${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/\r\?$//' |
${SED} 's/[ ]\+/ /' | sort >${T}/$$newdesc
if ! (head -1 ${T}/$$newdesc | egrep " [[:digit:]]+ [[:digit:]]+ " > /dev/null) ; then
comm -13 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$missingdesc
comm -23 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$removedesc
fi
if [ -s ${T}/$$remove ] ; then
(
echo "# The following newsgroups are non-standard."
${SED} "s/^/# /" ${T}/$$remove
echo "# You can remove them by executing the commands:"
for i in `cat ${T}/$$remove` ; do
echo " ${PATHBIN}/ctlinnd rmgroup $i"
${EGREP} "^$i " ${NEWSGROUPS} >>${T}/$$ngdel
done
echo ''
) >>${T}/$$out
fi
if [ -s ${T}/$$add ] ; then
(
echo "# The following newsgroups were missing and should be added."
${SED} "s/^/# /" ${T}/$$add
echo "# You can do this by executing the command(s):"
for i in `cat ${T}/$$add.unmod` ; do
echo " ${PATHBIN}/ctlinnd newgroup $i y ${FROM}"
${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngadd
done
for i in `cat ${T}/$$add.mod` ; do
echo " ${PATHBIN}/ctlinnd newgroup $i m ${FROM}"
${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngadd
done
echo ''
) >>${T}/$$out
fi
if [ -s ${T}/$$ismod ] ; then
(
echo "# The following groups are incorrectly marked as moderated:"
${SED} "s/^/# /" ${T}/$$ismod
echo "# You can correct this by executing the following:"
for i in `cat ${T}/$$ismod` ; do
echo " ${PATHBIN}/ctlinnd changegroup $i y"
${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngchng
done
echo ''
) >>${T}/$$out
fi
if [ -s ${T}/$$notmod ] ; then
(
echo "# The following groups are incorrectly marked as unmoderated:"
${SED} "s/^/# /" ${T}/$$notmod
echo "# You can correct this by executing the following:"
for i in `cat ${T}/$$notmod` ;do
echo " ${PATHBIN}/ctlinnd changegroup $i m"
${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngchng
done
echo ''
) >>${T}/$$out
fi
if [ -s ${T}/$$removedesc ] ; then
(
echo "# The following newsgroups descriptions are obsolete."
${SED} "s/^/# /" ${T}/$$removedesc
echo "# You can remove them by editing ${NEWSGROUPS}."
echo ''
) >>${T}/$$out
fi
if [ -s ${T}/$$missingdesc ] ; then
(
echo "# The following newsgroups descriptions were missing and should be added."
${SED} "s/^/# /" ${T}/$$missingdesc
echo "# You can add them by editing ${NEWSGROUPS}."
echo ''
) >>${T}/$$out
fi
test -s ${T}/$$out && {
cat ${T}/$$out
echo 'exit # so you can feed this message into the shell'
echo "# And remember to update ${NEWSGROUPS}."
test -s ${T}/$$ngdel && {
echo "# Remove these lines:"
${SED} "s/^/# /" ${T}/$$ngdel
echo ''
}
test -s ${T}/$$ngadd && {
echo "# Add these lines:"
${SED} "s/^/# /" ${T}/$$ngadd
echo ''
}
test -s ${T}/$$ngchng && {
echo "# Change these lines:"
${SED} "s/^/# /" ${T}/$$ngchng
echo ''
}
}
rm -f ${T}/$$*
|