#!/bin/sh set -eu PROJECT="$1" MAILING_LIST="$2" shift shift TLD="$(cat aux/tld.txt)" IN_PLACE=false while getopts 'i' flag; do case "$flag" in i) IN_PLACE=true ;; *) ;; esac done EXPECTED_EN="$(mktemp)" cat <> "$EXPECTED_EN" .SH AUTHORS .MT eu@euandre.org EuAndreh .ME and contributors. .SH BUGS .IP \(bu Report bugs to the .MT ~euandreh/$MAILING_LIST@lists.sr.ht mailing list .ME . Use the subject "\f(CR[$PROJECT] BUG or TASK: \fR". .IP \(bu Browse bugs .UR https://$TLD/$PROJECT/TODOs.html online .UE . .IP \(bu .UR https://$TLD/$PROJECT/ Homepage .UE . .IP \(bu .UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D Comments and discussions .UE . EOF EXPECTED_PT="$(mktemp)" cat <> "$EXPECTED_PT" .SH AUTORES .MT eu@euandre.org EuAndreh .ME e colaboradores. .SH BUGS .IP \(bu Relate bugs na .MT ~euandreh/$MAILING_LIST@lists.sr.ht lista de discussão .ME . Use o assunto "\f(CR[$PROJECT] BUG ou TASK: \fR". .IP \(bu Veja os bugs .UR https://$TLD/$PROJECT/TODOs.html online .UE . .IP \(bu .UR https://$TLD/$PROJECT/ Página inicial .UE . .IP \(bu .UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D Comentários e discussões .UE . EOF EXPECTED_FR="$(mktemp)" cat <> "$EXPECTED_FR" .SH AUTEURS .MT eu@euandre.org EuAndreh .ME et les contributeurs. .SH BUGS .IP \(bu Soumettre un bogue dans la .MT ~euandreh/$MAILING_LIST@lists.sr.ht liste de diffusion .ME . Utilise le sujèt "\f(CR[$PROJECT] BUG ou TASK: \fR". .IP \(bu Parcourir les bogues .UR https://$TLD/$PROJECT/TODOs.html en ligne .UE . .IP \(bu .UR https://$TLD/$PROJECT/ Page d'accueil .UE . .IP \(bu .UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D Commentaires et discussions .UE . EOF EXPECTED_EO="$(mktemp)" cat <> "$EXPECTED_EO" .SH AŬTOROJ .MT eu@euandre.org EuAndreh .ME kaj la kontribuuloj. .SH MISFUNKCIOJ .IP \(bu Raportu misfunkcioj al la .MT ~euandreh/$MAILING_LIST@lists.sr.ht dissendolisto .ME . Uzu la subjekton "\f(CR[$PROJECT] BUG aŭ TASK: \fR". .IP \(bu Foliumu misfunkcioj .UR https://$TLD/$PROJECT/TODOs.html rete .UE . .IP \(bu .UR https://$TLD/$PROJECT/ Ĉefpaĝo .UE . .IP \(bu .UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D Komentoj kaj diskutoj .UE . EOF # shellcheck disable=2044 for f in $(find doc -type f -name '*.[0-9]'); do LINES="$(wc -l "$f" | cut -d\ -f1)" if [ "$LINES" = 1 ] && grep -Eq '^\.so man.+$' "$f"; then continue fi lang="$(echo "$f" | cut -d. -f2)" case "$lang" in pt) EXPECTED="$EXPECTED_PT" ;; fr) EXPECTED="$EXPECTED_FR" ;; eo) EXPECTED="$EXPECTED_EO" ;; *) EXPECTED="$EXPECTED_EN" ;; esac if ! tail -n "$(wc -l < "$EXPECTED")" "$f" | diff - "$EXPECTED"; then echo "Missing metadata at the end of \"$f\" file" if [ "$IN_PLACE" = true ]; then cat "$EXPECTED" >> "$f" else exit 1 fi fi done