News-cancel devrait fonctionner malgr les deux fichiers d'overview, maintenant.

N.

darcs-hash:20030919122417-a279a-9b205d9a2ad36b29c42fbae7a728bba8cf8b246b.gz
This commit is contained in:
stransky 2003-09-19 14:24:17 +02:00
parent 818b33e670
commit 1da7f5f638

View file

@ -6,7 +6,7 @@
## Login stransky <stransky@crans.org>
##
## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY
## Last update sam 27 avr 2002 00:56:25 CEST Nicolas STRANSKY
## Last update ven 19 sep 2003 14:21:27 CEST Nicolas STRANSKY
##
## Script pour annuler ou modérer un message de news.
##
@ -20,19 +20,22 @@ if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]]
else moderateur=${ORIG_LOGNAME-$SUDO_USER}
fi
ovfiles=$(grep "^[[:digit:]]" /etc/news/buffindexed.conf | cut -d ':' -f 2 | tr "\n" " ")
groupe=adm
tempF=$(tempfile -d /tmp -p "newscancel")
tempF2=$(tempfile -d /tmp -p "newscancelcommentaire")
tempF3=$(tempfile -d /tmp -p "newscancelmessage")
VERIF () {
ligne=`grep --binary-files=text " $1 " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'`
ligne=`grep -h --binary-files=text " $1 " $ovfiles | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'`
auteur=`echo $ligne | awk -F "~" '{print $3}'`
titre=`echo $ligne | awk -F "~" '{print $2}'`
newsgroup=`echo $ligne | awk -F "~" '{print $4}' | awk '{print $3}' | awk -F : '{print $1}'`
#numero=`echo $ligne | awk -F "~" '{print $1}'`
numero=`echo $ligne | awk -F "~" '{print $4}' |awk -v VAR1=$newsgroup 'BEGIN {RS = " "} ; $0 ~ VAR1 {print $1}' | awk -F ":" '{print strtonum($2)}'`
echo "il s'agit du message $titre, numéro $numero, posté par $auteur dans $newsgroup"
if [[ $ligne != "" ]] ; then
echo "il s'agit du message \"$titre\", numéro $numero, posté par $auteur dans $newsgroup"
echo ""
echo -n "exact ? [o/n] "
read confirmation
@ -45,6 +48,10 @@ VERIF () {
exit 0
;;
esac
else
echo "Aucun message ne correspond à cette ID"
exit 1
fi
}