7
0
mirror of https://github.com/marado/RNID.git synced 2024-11-10 00:40:40 +00:00
rnid/scripts/14-mai.sh
Marcos Marado a406d18fb9 mai: exposing wget's return code when it fails
Apparently the test is currently failing in environments with OpenSSL
3. Lazilly, I'm going to change the test in order to have it run
remotely on github instead of creating a local environment with that
version of OpenSSL. This is a step into adding an SSL test step.
2023-07-06 19:49:51 +01:00

24 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx -o /dev/null -O -|grep -v __REQUESTDIGEST|grep -v VIEWSTATE|hxnormalize -x -l 1000|hxselect .conteudo > mai-tmp
cat mai-tmp|hxselect a -s'\n' > mai
if [ ! "$(diff mai scripts/14/mai|wc -l)" -eq "0" ]; then
echo "mai: incumprimento pode já não existir";
echo "DEBUG: mai-tmp:"
cat mai-tmp
echo "EOF"
echo "EXTRA DEBUG:"
# wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx && cat default.aspx && rm default.aspx
echo "wget's return code is:"
wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx && echo $?
else
echo "mai: Incumprimento mantém-se, a actualizar o README (faça um git diff, valide, e commit!)";
while IFS='' read -r line || [[ -n "$line" ]]; do
test "$(echo "$line"|grep -c -v sg.mai)" -eq "1" \
&& echo "$line" \
|| (h=$(echo "$line"|cut -d\| -f1-4); t=$(echo "$line"|cut -d\| -f6-); echo "$h| $(date +%Y/%m/%d) |$t");
done < README.md > new
mv new README.md
fi
rm mai-tmp mai