Skip to Content.
Sympa Menu

en - Re: [sympa-users] Custom mhonarc script, trouble after upgrade...

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: Marco Gaiarin <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-users] Custom mhonarc script, trouble after upgrade...
  • Date: Tue, 26 Feb 2019 14:46:28 +0900

Hi Marco,

On Sun, 24 Feb 2019 22:53:36 +0100
Marco Gaiarin <address@concealed> wrote:

> Mandi! "Stefan Hornburg (Racke)"
> In chel di` si favelave...
>
> > it would be helpful to provide the script.
>
> Oh, sure!
>
> root@eraldo:~# egrep -v "^[[:space:]]*#" /usr/local/sbin/smhawrap | egrep
> -v "^$"
> LOG="/tmp/smhawrap.log"
> BMBOX="/tmp/smhawrap.mbox"
> MHONARC="/usr/bin/mhonarc"
> GATEBIN="/usr/local/bin/mail2news"
> FORMAIL="/usr/bin/formail -I Approved:"
> NEWSMAP="/etc/sympa/newsmap"
> TMPF=$(tempfile --prefix smhawrap)
> cat - | $FORMAIL > $TMPF
> case $1 in
> -add)
> LISTNAME=$(echo ${10} | sed -e
> "s/.*listname='\([^']*\)'.*/\1/1")
> LISTHOST=$(echo ${10} | sed -e "s/.*hostname=\([^
> ]*\).*/\1/1")
> NGNAME=$(cat $NEWSMAP | grep "^$LISTNAME, $LISTHOST: " | cut
> -d ':' -f 2 | tr -d ' ')
> if [ -n "$LOG" ]; then
> if [ -n "$NGNAME" ]; then
> echo "$GATEBIN NEWSGROUP=$NGNAME
> LIST=$LISTNAME@$LISTHOST TAG=$LISTNAME" >> $LOG
> fi
> echo "$MHONARC $1 $2 $3 '$4' $5 $6 $7 $8 $9 \"${10}\"
> ${11} ${12}" >> $LOG
> fi
> if [ -n "$BMBOX" ]; then
> cat $TMPF >> $BMBOX
> fi
> if [ -n "$NGNAME" ]; then
> cat $TMPF | $GATEBIN NEWSGROUP=$NGNAME
> LIST=$LISTNAME@$LISTHOST TAG=$LISTNAME
> fi
> $MHONARC $1 $2 $3 '$4' $5 $6 $7 $8 $9 "${10}" ${11} ${12} <
> $TMPF
> ;;
> -outdir)
> if [ -n "$LOG" ]; then
> echo "$MHONARC $1 $2 $3 $4" >> $LOG
> fi
> $MHONARC $1 $2 $3 $4
> ;;
> -modifybodyaddresses)
> if [ -n "$LOG" ]; then
> echo "$MHONARC $1 $2 $3 '$4' $5 $6 $7 $8 \"${9}\"
> ${10} ${11}" >> $LOG
> fi
> $MHONARC $1 $2 $3 '$4' $5 $6 $7 $8 "${9}" ${10} ${11}
> ;;
> *)
> if [ -n "$LOG" ]; then
> echo "Unknown call: $MHONARC $1 $2 $3 '$4' $5 $6 $7
> $8 \"${9}\" ${10} ${11}" >> $LOG
> fi
> ;;
> esac
> rm -f $TMPF

I compared "mhonarc -add" case with Sympa 6.1.x (jessie) and 6.2.x (stretch
and buster).

On Sympa 6.1.x:
https://github.com/sympa-community/historic-sympa/blob/6.1.23/wwsympa/archived.pl.in#L908

/path/to/mhonarc \
-add \
-modifybodyaddresses \
-addressmodifycode 'XXX' \
-rcfile /path/to/mhonarc-ressources.tt2 \
-outdir /path/to/arc/LIST@DOMAIN/YYYY/MM \
-definevars "listname='LIST' hostname=DOMAIN yyyy=YYYY mois=MM yyyymm=YYYY-MM
wdir=/path/to/arc base=URL/arc tag=XXXXXXXXXX" \
-umask 027

On Sympa 6.2.x:
https://github.com/sympa-community/sympa/blob/6.2.40/src/lib/Sympa/Archive.pm#L493-L510

/path/to/mhonarc \
-add \
-addressmodifycode 1 \
-rcfile /path/to/mhonarc-ressources.tt2 \
-outdir /path/to/arc/LIST@DOMAIN/YYYY/MM \
-definevars "listname='LIST' hostname=DOMAIN yyyy=YYYY mois=MM yyyymm=YYYY-MM
wdir=/path/to/arc base=URL/arc tag=XXXXXXXXXX with_tslice=1
with_powered_by=1" \
-umask 027

With 6.2.x, your script looks breaking arguments, because the value
of "-definedvars" option is the 9th argument.


> > To see how bash processes the script, add the following line in the
> > beginning of it:
> > set -x
>
> Sure but... logs goes to? sympa syslog? where?

I guess that, if BASH_XTRACEFD=2 was set, outout will go to stderr
which will be redirected to *.stderr file in SPOOLDIR/tmp (though I
haven't confirmed).


Regards,
-- Soji

> Thanks.
>
> --
> Non sara` il canto delle sirene che ci innamorera`
> noi lo conosciamo bene, l'abbiamo sentito gia` (F. De Gregori)
>
>


--
株式会社 コンバージョン
ITソリューション部 システムソリューション1グループ 池田荘児
〒140-0014 東京都品川区大井1-49-15 アクセス大井町ビル4F
e-mail address@concealed TEL 03-6429-2880
https://www.conversion.co.jp/



Archive powered by MHonArc 2.6.19+.

Top of Page