mirror of https://framagit.org/kyodev/kyopages.git
v19/08/2017
This commit is contained in:
parent
b91b66e3fe
commit
e204dcd1d1
|
@ -1,11 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# mise à jour 26/07/2017
|
||||
version=19/08/2017
|
||||
|
||||
user_agent="Mozilla/5.0 Firefox"
|
||||
file_tempo_test="tempoTest-$RANDOM"
|
||||
|
||||
# test wget, $1 url à tester, $2 objet, affiche url testée & entêtes http & location
|
||||
f_help(){
|
||||
[ "$(which figlet)" ] && figlet "$(basename $0)" || echo -e "\t\t\t$(basename $0)"
|
||||
echo -e "\t\t\tversion $version\n"
|
||||
cat << 'EOF'
|
||||
----------------------------------------------------------------------
|
||||
pour chaque architecture linux ou linux64 (32 ou 64 bits):
|
||||
==========================================================
|
||||
canal: url récup canal
|
||||
HTTP/1.1 302 Found HTTP/1.1 200 OK --> 302: redirection temporaire (normal) 200: archive trouvée, téléchargeable
|
||||
une erreur 404 indiquerait une nouvelle url à déterminer
|
||||
une erreur 5xx indiquerait une erreur au niveau du serveur, réessayer +tard
|
||||
une erreur 4xx.. humm, réessayer +tard?
|
||||
|
||||
Location: url réelle de l'archive du canal
|
||||
|
||||
=== versions ===
|
||||
Beta/Dev: xyz --> la version xyz est bient détecté, sinon revoir cette fonction
|
||||
Nightly : xyz --> la version xyz est bient détecté, sinon revoir cette fonction
|
||||
|
||||
EOF
|
||||
echo
|
||||
exit
|
||||
}
|
||||
|
||||
# test wget, $1 url à tester, $2 produit, affiche url testée & entêtes http & location
|
||||
f__wget_entete_diag(){
|
||||
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>$file_tempo_test
|
||||
local http="$(grep -i 'HTTP/' $file_tempo_test)"
|
||||
|
@ -16,25 +40,25 @@ f__wget_entete_diag(){
|
|||
echo "$http" | grep '40' &>/dev/null && echo " ERREUR 404" || echo "$location"
|
||||
}
|
||||
|
||||
[ "$1" == "-h" ] && f_help
|
||||
|
||||
for architecture in linux linux64; do
|
||||
echo -e "\nArchitecture: $architecture"
|
||||
echo "====================="
|
||||
for product in latest esr beta dev nightly; do
|
||||
if [ "$product" == "latest" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$product&os=$architecture&lang=fr"
|
||||
elif [ "$product" == "esr" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$product-latest&os=$architecture&lang=fr"
|
||||
elif [ "$product" == "beta" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-beta-latest&os=$architecture&lang=fr"
|
||||
elif [ "$product" == "dev" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=$architecture&lang=fr"
|
||||
elif [ "$product" == "nightly" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$product-latest-l10n-ssl&os=$architecture&lang=fr" ;fi
|
||||
f__wget_entete_diag "$recup_url" "$product"
|
||||
for produit in latest esr beta dev nightly; do
|
||||
if [ "$produit" == "latest" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$produit&os=$architecture&lang=fr"
|
||||
elif [ "$produit" == "esr" ] || [ "$produit" == "beta" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$produit-latest&os=$architecture&lang=fr"
|
||||
elif [ "$produit" == "dev" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$produit""edition-latest-ssl&os=$architecture&lang=fr"
|
||||
elif [ "$produit" == "nightly" ]; then
|
||||
recup_url="https://download.mozilla.org/?product=firefox-$produit-latest-l10n-ssl&os=$architecture&lang=fr" ;fi
|
||||
f__wget_entete_diag "$recup_url" "$produit"
|
||||
done
|
||||
done
|
||||
|
||||
echo -e "\n===== versions ======"
|
||||
echo -e "\n=== versions ==="
|
||||
recup_url="https://download.mozilla.org/?product=firefox-beta-latest&os=linux64&lang=fr"
|
||||
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$recup_url" &>"$file_tempo_test"
|
||||
verBeta="$(grep -i 'location' $file_tempo_test | sed -E 's/.*firefox-(.*)\.tar.bz2/\1/')"
|
||||
|
@ -45,8 +69,7 @@ verNightly="$(grep -i 'location' $file_tempo_test | sed -E 's/.*firefox-(.*)\.fr
|
|||
|
||||
echo "Beta/Dev: $verBeta"
|
||||
echo "Nightly : $verNightly"
|
||||
|
||||
echo ""
|
||||
echo
|
||||
|
||||
rm $file_tempo_test
|
||||
|
||||
|
|
Loading…
Reference in New Issue