30/08/2017

This commit is contained in:
kyodev 2017-08-30 22:43:58 +02:00
parent 99805570bd
commit 2100e86bb1
2 changed files with 41 additions and 31 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=30/08/2017
version=30/08/2017-2
f__affichage(){
# définition couleurs
@ -9,8 +9,8 @@ f__affichage(){
BLUE="$(printf "\033[0;34m")" # info
RED="$(printf "\033[0;31m")" # alerte
COLOR="$(printf "\033[0m")" # standard
clear
[ "$1" == all ] || return
clear
printf "$YELLOW"
[ "$(which figlet)" ] && figlet "$(basename $0)" || echo -e "\t\t\t$(basename $0)"
echo -e "$GREEN\t\t\tversion $version$COLOR\n"
@ -21,20 +21,24 @@ f_help(){
printf $BLUE
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?
=== versions Firefox ===
latest: NA ESR: x.y.z Beta/Dev: x.y.z Nightly : x.y.z
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
Location: url réelle de l'archive du canal si redirection
=== 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
=== Tor Browser ===
Tor Browser: x.y.z
url récup Tor Browser HTTP/1.1 302 Found HTTP/1.1 200 OK
Location: url réelle de l'archive Tor Browser si redirection
--------
HTTP: 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?
x.y.z la version est bien détectée
NA la version n'est pas accessible, revoir cette fonction
----------------------------------------------------------------------
liens de téléchargement manuels:
latest & esr : https://www.mozilla.org/en-US/firefox/notes/
@ -68,24 +72,23 @@ f__wget_test_diag(){ #v30/08/2017
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$YELLOW"
[ "$location" ] && echo " $location" || echo " no location"
fi
echo "$COLOR"
printf "$COLOR"
rm "$file_test_wget"
[ "$retourWget" ] && exit 1
}
test_url_dl(){
test_url_dl_firefox(){
for architecture in linux linux64; do
echo " Architecture: $architecture"
echo " ====================="
echo " Architecture: $architecture"
echo " ====================="
local recup_url
# for produit in latest esr beta dev nightly; do
for produit in latest esr beta nightly; do
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" == "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
printf " $produit":
@ -96,7 +99,7 @@ done
# assigne $verLatest, $verEsr, $verBeta, $verNightly
test_version_firefox(){
echo " === versions Firefox ==="
echo -e "\n === versions Firefox ==="
local recup_url
recup_url="https://www.mozilla.org/en-US/firefox/notes/"
@ -111,22 +114,28 @@ test_version_firefox(){
recup_url="https://download.mozilla.org/?product=firefox-nightly-latest-l10n-ssl&os=linux64&lang=fr"
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$recup_url" &>"$file_tempo_test"
verNightly="$(grep -i 'location' $file_tempo_test | sed -E 's/.*firefox-(.*)\.fr.linux.*/\1/')"
[ "$verLatest" ] || verLatest="$RED""NA"
[ "$verEsr" ] || verEsr="$RED""NA"
[ "$verBeta" ] || verBeta="$RED""NA"
[ "$verNightly" ] || verNightly="$RED""NA"
echo -e " latest: $GREEN$verLatest$COLOR \tESR: $GREEN$verEsr$COLOR \tBeta/Dev: $GREEN$verBeta$COLOR \tNightly : $GREEN$verNightly"
echo "$COLOR"
printf "$COLOR"
}
# assigne $verTor
test_version_torBrowser(){
echo " === Tor Browser ==="
echo -e "\n === Tor Browser ==="
local recup_url="https://www.torproject.org/projects/torbrowser.html.en"
wget -q --tries=2 --timeout=15 --user-agent="$user_agent" -O - "$recup_url" &>"$file_tempo_test"
verTor="$(sed -En 's/^.*torbrowser\/([0-9.]*)\/.*_fr\.tar\.xz.*$/\1/p' $file_tempo_test | sed -n '1p')"
echo -e " Tor Browser: $GREEN$verTor"
echo "$COLOR"
[ "$verTor" ] || verTor="$RED""NA"
echo -e " Tor Browser: $GREEN$verTor$COLOR"
}
#$1 version
test_url_dl_tb(){
test_url_dl_torBrowser(){
#https://www.torproject.org/dist/torbrowser/7.0.4/tor-browser-linux64-7.0.4_fr.tar.xz
#https://www.torproject.org/dist/torbrowser/7.0.4/tor-browser-linux64-7.0.4_fr.tar.xz.asc
local recup_url
@ -144,10 +153,11 @@ file_tempo_test="tempoDiag-$RANDOM"
f__affichage
[ "$1" == "-h" ] && f_help
test_url_dl
test_version_firefox
test_url_dl_firefox
test_version_torBrowser
test_url_dl_tb "$verTor"
test_url_dl_torBrowser "$verTor"
echo
rm $file_tempo_test

View File

@ -38,7 +38,7 @@ f__wget_test_diag(){ #v30/08/2017
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$YELLOW"
[ "$location" ] && echo " $location" || echo " no location"
fi
echo "$COLOR"
printf "$COLOR"
rm "$file_test_wget"
[ "$retourWget" ] && exit 1
}