diff --git a/scripts/getFirefox b/scripts/getFirefox index e90048c..f767133 100755 --- a/scripts/getFirefox +++ b/scripts/getFirefox @@ -1,6 +1,6 @@ #!/bin/bash -version=4.2.0 +version=4.3.0 date="24/12/2017" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" @@ -198,16 +198,16 @@ f__user(){ # 3/12/2017 return 0 } - # test wget, $1=url à tester, sortie du script (même si url testée ok) avec affichage erreur ou ok + # test wget, $1=url à tester, $2=''|print|loc|test + # par défaut, sortie du script (même si url testée ok) avec affichage erreur ou ok # si $2=print affiche url testée & entêtes http & location, return 0 # si $2=loc affiche seulement location, return 0 # si $2=test return 0 si ok, return 1 si KO -f__wget_test(){ # 23/12/2017 - local file_test_wget="/tmp/testWget-$script" retourWget retourHttp location wget_log="/tmp/testWget_$RANDOM.log" +f__wget_test(){ # 24/12/2017 + local file_test_wget="/tmp/testWget-$script" retourWget retourHttp location - wget -Sq --timeout=5 --tries=2 --user-agent="$user_agent" -o "$wget_log" --spider --save-headers "$1" &>"$file_test_wget" + wget -Sq --timeout=5 --tries=2 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" retourWget="$?" - rm "$wget_log" [ "$retourWget" == 1 ] && retourWget="1: code erreur générique" [ "$retourWget" == 2 ] && retourWget="2: parse erreur (ligne de commande?)" [ "$retourWget" == 3 ] && retourWget="3: erreur Entrée/sortie fichier" @@ -220,7 +220,6 @@ f__wget_test(){ # 23/12/2017 location=$( grep -i 'location' $file_test_wget | xargs ) if [ "$2" == "test" ]; then rm -f "$file_test_wget" - rm -f "$wget_log" # spécial maintenance frama.link, pas de redirection sur page status framalink grep -q '303' <<< $retourHttp && return 1 # 303 See Other [ "$retourWget" == "0" ] && return 0 || return 1 @@ -235,15 +234,13 @@ f__wget_test(){ # 23/12/2017 echo "$STD" fi if [ "$2" == "print" ] || [ "$2" == "loc" ]; then - [ "$location" ] && echo -n "$YELLOW $location" || echo -n "$YELLOW no location" + [ "$location" ] && echo -n "$YELLOW$location" || echo -n "$YELLOW""no location" echo "$STD" rm -f "$file_test_wget" - rm -f "$wget_log" return 0 fi if [ "$retourWget" != "0" ]; then - rm "$file_test_wget" - rm -f "$wget_log" + rm -f "$file_test_wget" f__error "wget, erreur $retourWget" "$1" "$YELLOW$retourHttp" "$location" echo -e "$RED erreur wget, $retourWget \n $1 \n $YELLOW$retourHttp \n $location$STD" # pour les diags return 1 @@ -251,8 +248,7 @@ f__wget_test(){ # 23/12/2017 if grep -q '200' <<< $retourHttp; then echo -e "$GREEN\ntout est ok, réessayer$STD\n" fi - rm "$file_test_wget" - rm -f "$wget_log" + rm -f "$file_test_wget" exit 0 } @@ -369,12 +365,11 @@ ffx_get_canalBas(){ # 18/12/2017 [ "$ffx_canal_bas" ] && return || return 1 } - # version en ligne et installée, affichage, [$1=quiet] -ffx_get_version(){ # 23/12/2017 + # version en ligne et installée, affichage +ffx_get_version(){ # 24/12/2017 local recup_url ver_latest ver_esr ver_beta ver_nightly ii - local verFFxInstall='' verFFxOnline='' pointeur appli="Firefox" fileTmp="/tmp/$script-getVersion_${appli// }" + local verFfxInstall='' verFfxOnline='' pointeur appli="Firefox" fileTmp="/tmp/$script-getVersion_${appli// }" - x_get_version=1 echo -n " ." #recup url # version latest & esr @@ -409,25 +404,24 @@ ffx_get_version(){ # 23/12/2017 # versions en ligne [ "$ii" == "dev" ] && continue pointeur="ver_$ii" - verFFxOnline+=$( printf "%-7s: %-10s" $ii ${!pointeur} ) + verFfxOnline+=$( printf "%7s: %-7s " $ii ${!pointeur} ) [[ "${!pointeur}" != "$RED""n/a" ]] && (( compteur++ )) # versions installées if [ -x "$dirInstallFfx$ii/firefox" ]; then - verFFxInstall+=$( printf "%-7s: %-10s" $ii $( $dirInstallFfx$ii/firefox -v | grep -Eo '[0-9].*' ) ) + verFfxInstall+=$( printf "%7s: %-7s " $ii $( $dirInstallFfx$ii/firefox -v | grep -Eo '[0-9].*' ) ) (( compteur2++ )) else - verFFxInstall+=$( printf " %.s" $(seq 19) ) + verFfxInstall+=$( printf " %.s" $(seq 17) ) fi done - verFFxOnline="$appli en ligne: $YELLOW$verFFxOnline" - [ "$( xargs <<< $verFFxInstall )" ] || verFFxInstall="Non installé" - verFFxInstall="$appli en place: $GREEN$verFFxInstall" - [ "$1" == "quiet" ] && return 0 + + [[ $( xargs <<< $verFfxInstall ) ]] || verFfxInstall="Non installé" + [[ $( xargs <<< $verFfxOnline ) ]] || verFfxOnline="$RED""n/a" echo -e "\n" - f__info "raw" "$verFFxInstall" - f__info "$verFFxOnline" + f__info "raw" "$appli en place: $GREEN$verFfxOnline" + f__info "$appli en ligne: $YELLOW$verFfxInstall" } # ascii art godzilla @@ -563,7 +557,7 @@ ffx_lanceur_desktop(){ # 18/12/2017 } # version personnalisation en ligne, [$1=quiet], assigne $perso_ffx_afaire -ffx_pers_get_version(){ # 23/12/2017 +ffx_pers_get_version(){ # 24/12/2017 local ii verEnPlace persEnPlace verPersOnline appli="Firefox" x_ffx_pers_get_version=1 @@ -581,14 +575,13 @@ ffx_pers_get_version(){ # 23/12/2017 perso_ffx_afaire="$ii " fi done - [ "$1" == "quiet" ] && return 0 - if [ "$persEnPlace" ]; then - f__info "raw" "perso. $appli en place : $GREEN$persEnPlace" - else - f__info "raw" "perso. $appli en place :$GREEN Non installé" - fi - f__info "perso. $appli en ligne : $YELLOW$verPersOnline" + + [[ $( xargs <<< $persEnPlace ) ]] || persEnPlace="Non installé" + [[ $( xargs <<< $verPersOnline ) ]] || verPersOnline="$RED""n/a" + + f__info "raw" "perso. $appli en place: $GREEN$persEnPlace" + f__info "perso. $appli en ligne: $YELLOW$verPersOnline" } # recup user.js et chrome/userChrome.css, $1=canal à personnaliser ou mettre à jour @@ -612,7 +605,7 @@ ffx_pers_install(){ # 23/12/2017 cp "$dirTemp/user.js" "$dirProfilFfx/$canal/" chown "$fu_user:" "$dirProfilFfx/$canal/user.js" if [ -e "$dirTemp/userChrome.css" ]; then - "$dirTemp/userChrome.css" "$dirProfilFfx/$canal/chrome" + cp "$dirTemp/userChrome.css" "$dirProfilFfx/$canal/chrome" chown "$fu_user:" "$dirProfilFfx/$canal/chrome/userChrome.css" fi echo "$urlPersFfx" > "$dirProfilFfx/$canal/personnalisation" @@ -936,9 +929,9 @@ url_notice="https://kyodev.frama.io/kyopages/scripts/$script/" # paramètres firefox dirInstallFfx="/opt/usr/share/firefox-" dirProfilFfx="/home/$fu_user/.mozilla/firefox" # emplacement profiles.ini - # url chargement fichiers personnalisation, std ou spécifique, une seule url possible, arret à la première trouvée produit_all="esr latest beta nightly" # tous les canaux sauf dev (=beta) produit_all_inverse="nightly beta latest esr" # tous les canaux sauf dev (=beta) + # url chargement fichiers personnalisation, std ou spécifique, une seule url possible, arrêt à la première trouvée for ii in $produit_all dev; do # renommage anciens fichiers personnalisation [ -e "$dirProfilFfx/$ii/personnalisation.getFirefox" ] && mv "$dirProfilFfx/$ii/personnalisation.getFirefox" "$dirProfilFfx/$ii/personnalisation" # ancien nom done diff --git a/scripts/getFirefox_changelog.md b/scripts/getFirefox_changelog.md index e48a45c..892d12d 100644 --- a/scripts/getFirefox_changelog.md +++ b/scripts/getFirefox_changelog.md @@ -1,9 +1,12 @@ # changelog getFirefox -## getFirefox 4.2.0 24/12/2017 +## getFirefox 4.3.0 24/12/2017 +* cosmétique +* fix: f__wget_test, incompatible avec redirection logs * fix: typo fscript_update +* fix: typo ffx_pers_install ## getFirefox 4.1.0 23/12/2017