From e1da5deb442cd35c94ea299907e3595ec70c081b Mon Sep 17 00:00:00 2001 From: kyodev Date: Tue, 12 Jun 2018 22:01:02 +0200 Subject: [PATCH] maj --- docs/scripts/getFirefox.md | 63 ++--- docs/scripts/getFlashPlayer.md | 2 +- scripts/getFirefox | 436 +++++++++++++++++---------------- scripts/getFlashPlayer | 5 +- 4 files changed, 257 insertions(+), 249 deletions(-) diff --git a/docs/scripts/getFirefox.md b/docs/scripts/getFirefox.md index d2f6feb..ca887ce 100644 --- a/docs/scripts/getFirefox.md +++ b/docs/scripts/getFirefox.md @@ -11,7 +11,7 @@ > Ceux qui ne croient pas en l'avenir marketé _fabuleux_ de Quantum (publicité intégrée à venir, webextension limitées chez Mozilla, etc), qui présage plutôt un suivi sans saveur de Google Chrome, en attendant son abandon après une longue agonie déjà amorcée depuis longtemps, peuvent [tester Waterfox](https://framaclic.org/h/doc-getxfox) > Waterfox est un fork basé sur l'ancien moteur avec tout les extensions fonctionnelles et une bien plus grande liberté de personnalisation -![version: 4.21.2](https://img.shields.io/badge/version-4.21.2-blue.svg?longCache=true&style=for-the-badge) +![version: 4.23.0](https://img.shields.io/badge/version-4.23.0-blue.svg?longCache=true&style=for-the-badge) ![bash langage](https://img.shields.io/badge/bash-4-brightgreen.svg?longCache=true&style=for-the-badge) ![license LPRAB / WTFPL](https://img.shields.io/badge/license-LPRAB%20%2F%20WTFPL-blue.svg?longCache=true&style=for-the-badge) @@ -49,9 +49,9 @@ chmod +x getFirefox && ./getFirefox / _' |/ _ \ __| |_ | | '__/ _ \ |_ / _ \ \/ / | (_| | __/ |_| _| | | | | __/ _| (_) > < \__, |\___|\__|_| |_|_| \___|_| \___/_/\_\ - |___/ version 4.21.0 - 07/06/2018 + |___/ version 4.22.0 - 12/06/2018 - getFirefox 4.21.0 installé dans le système. + getFirefox 4.22.0 installé dans le système. maintenant, appel du script par: getFirefox (sans ./) ``` @@ -71,26 +71,27 @@ getFirefox i-canal * la version stable en cours de Firefox est nommée **latest** ```text - _ _____ _ __ - __ _ ___| |_| ___(_)_ __ ___ / _| _____ __ - / _' |/ _ \ __| |_ | | '__/ _ \ |_ / _ \ \/ / - | (_| | __/ |_| _| | | | | __/ _| (_) > < - \__, |\___|\__|_| |_|_| \___|_| \___/_/\_\ - |___/ version 4.21.0 - 07/06/2018 - - installation Firefox-latest + _ _____ _ __ + __ _ ___| |_| ___(_)_ __ ___ / _| _____ __ + / _' |/ _ \ __| |_ | | '__/ _ \ |_ / _ \ \/ / + | (_| | __/ |_| _| | | | | __/ _| (_) > < + \__, |\___|\__|_| |_|_| \___|_| \___/_/\_\ + |___/ version 4.22.0 - 12/06/2018 + + installation Firefox-nightly - téléchargement... -/tmp/getFirefox-install_ffx/fi 100%[==========================================>] 51,30M 4,66MB/s ds 11s +/tmp/getFirefox-install_ffx/firefox-62.0a1_night 100%[============================>] 59,86M 5,66MB/s ds 12s - décompression... - installation... - profil Firefox latest configuré - Firefox latest est le défaut système - Firefox-latest installé + profil Firefox nightly configuré + Firefox nightly est le défaut système + + Firefox-nightly 62.0a1 installé ``` @@ -134,26 +135,28 @@ getFirefox -h / _' |/ _ \ __| |_ | | '__/ _ \ |_ / _ \ \/ / | (_| | __/ |_| _| | | | | __/ _| (_) > < \__, |\___|\__|_| |_|_| \___|_| \___/_/\_\ - |___/ version 4.21.0 - 07/06/2018 - ---------------------------------------------------------------------- - canaux possibles: latest, beta, nightly, dev, esr - = tous les canaux + |___/ version 4.22.0 - 12/06/2018 + + canaux possibles: latest, beta, nightly, dev, esr ( = tous les canaux sauf dev ) + exemple, installation version Release (latest): getFirefox i-latest - + ---------------------------------------------------------------------- getFirefox i-canal : installation de Firefox (root) - avec option --sauve l'archive téléchargée est sauvegardée dans le répertoire courant - getFirefox d-canal : copier un éventuel profil .default existant sur getFirefox m-canal archi : installation sur le d'une ve téléchargée manuellement (root) getFirefox r-canal : désinstallation (remove) du (root) getFirefox ri : réparation icône(s) et lanceur(s) dans le menu (root) + getFirefox t-canal : téléchargement du dans le répertoire courant (sans installation) getFirefox u-canal : profil pour l'utilisateur en cours et comme défaut système (root) - + getFirefox p-canal : personnalisation sur le de user.js & userChrome.css getFirefox pr-canal : suppression des personnalisations (remove) sur le getFirefox pu : mise à jour des personnalisations (update) installées - + getFirefox version : versions installées et en ligne + + --dev : une version de dev du script (si existante) est recherchée + --sauve : le téléchargement est sauvegardé dans le répertoire courant en plus de l'installation ---------------------------------------------------------------------- ./getFirefox (ou ./getFirefox -i) : installation du script dans le système (root) getFirefox -h, --help : affichage aide @@ -162,7 +165,7 @@ getFirefox -h getFirefox -v, --version : version du script plus d'infos: https://framaclic.org/h/doc-getfirefox -Tor Browser, voir getXfox: https://framaclic.org/h/doc-getxfox + Tor Browser, voir getXfox: https://framaclic.org/h/doc-getxfox ``` @@ -178,15 +181,15 @@ getFirefox version / _' |/ _ \ __| |_ | | '__/ _ \ |_ / _ \ \/ / | (_| | __/ |_| _| | | | | __/ _| (_) > < \__, |\___|\__|_| |_|_| \___|_| \___/_/\_\ - |___/ version 4.21.0 - 07/06/2018 + |___/ version 4.22.0 - 12/06/2018 - script en place: 4.20.1 - script en ligne: 4.20.1 + script en place: 4.22.0 + script en ligne: 4.22.0 .....++++ - Firefox en place: esr: 52.6.0 beta: 61.0 - Firefox en ligne: esr: n/a latest: 60.0.2 beta: 61.0b11 nightly: 62.0a1 + Firefox en place: esr: 52.6.0 beta: 61.0 nightly: 62.0a1 + Firefox en ligne: esr: 60.0.2 latest: 60.0.2 beta: 61.0b12 nightly: 62.0a1 esr_old: 52.8.1 perso. Firefox en place: esr: 0.6 beta: 0.6 perso. Firefox en ligne: 0.6 diff --git a/docs/scripts/getFlashPlayer.md b/docs/scripts/getFlashPlayer.md index 45bb0c2..dd2a7bc 100644 --- a/docs/scripts/getFlashPlayer.md +++ b/docs/scripts/getFlashPlayer.md @@ -1,7 +1,7 @@ # getFlashPlayer -![version: 4.12.0](https://img.shields.io/badge/version-4.12.0-blue.svg?longCache=true&style=for-the-badge) +![version: 4.13.O](https://img.shields.io/badge/version-4.13.O-blue.svg?longCache=true&style=for-the-badge) ![bash langage](https://img.shields.io/badge/bash-4-brightgreen.svg?longCache=true&style=for-the-badge) ![license LPRAB / WTFPL](https://img.shields.io/badge/license-LPRAB%20%2F%20WTFPL-blue.svg?longCache=true&style=for-the-badge) diff --git a/scripts/getFirefox b/scripts/getFirefox index 6bf8da6..d419c55 100755 --- a/scripts/getFirefox +++ b/scripts/getFirefox @@ -1,13 +1,9 @@ #!/bin/bash -# shellcheck disable=SC2119,SC2120 -# SC2119 Use function "$@" if function's $1 should mean script's $1 (??) -# SC2120 function references arguments, but none are ever passed. - -version=4.21.2 -date="09/06/2018" -#contact="IRC ##sdeb@freenode.net ou https://framagit.org/sdeb/getFirefox/issues" +version=4.23.0 +date="12/06/2018" script="getFirefox" +#contact="IRC ##sdeb@freenode.net ou https://framagit.org/sdeb/getFirefox/issues" ##### license LPRAB/WTFPL # auteur: simpledeb @@ -17,13 +13,11 @@ script="getFirefox" # détection architecture système, assigne $fu_archi: linux|linux64 # return 1 on unknown architecture # remarque, debian: dpkg --print-architecture affiche i386 -f__architecture(){ # 14/12/2017 SPÉCIFIQUE +f__architecture(){ # 09/O6/2018 SPÉCIFIQUE case "$(uname -m)" in - amd64 | x86_64 ) - fu_archi="linux64";; - i?86 | x86 ) - fu_archi="linux";; + amd64 | x86_64 ) fu_archi="linux64";; + i?86 | x86 ) fu_archi="linux";; * ) case "$(getconf LONG_BIT)" in 64 ) @@ -120,7 +114,7 @@ f__log(){ # 05/03/2018 # recherche commandes/paquets, $1 liste: cmd1|cmd2[>paquet] (séparées par espaces) ex: "gawk|mawk>gawk wget" # si manque, return 1 & affiche commandes manquantes (si debian, ajout proposition paquet à installer) -f__requis(){ # 06/06/2018 +f__requis(){ # 11/06/2018 local ENV_DEBIAN c_echo ireq cmds package commands command commandsMissing packagesMissing if type -p dpkg &>/dev/null ; then @@ -134,7 +128,7 @@ f__requis(){ # 06/06/2018 for ireq in $1; do IFS='>' read -r cmds package <<< "$ireq" # ex: "awk|gawk>gawk wget file tar killall>psmisc" mapfile -t -d '|' commands <<< "${cmds}" - [ -z "$package" ] && package=${commands[0]%$'\n'} # pas de packages dans les options, donc = commands[0 + [ -z "$package" ] && package=${commands[0]%$'\n'} # pas de packages dans les options, donc = commands[0] for command in "${commands[@]%$'\n'}"; do if type -p "$command" &>/dev/null ; then unset commandsMissing packagesMissing @@ -163,40 +157,14 @@ f__requis(){ # 06/06/2018 [ "$commandsMissing" ] && return 1 || return 0 } - # $@=cmd à lancer en root avec su ou sudo. si $@ contient [':x:'] x=nombre de tentatives, 3 par défaut - # si sudo si possible sera utilisé. - # si su &2 redirigé sur &1 - # si bash inexistant, return 2 -f__sudo(){ # 07/06/2018 - local nb sudo isudo options nbDefault=3 + # $@=cmd à lancer en root avec su ou sudo. si sudo possible: prioritairesu su +f__sudo(){ # 11/06/2018 - # détermination sudo possible if sudo -v &>/dev/null && [ $EUID -ne 0 ] ; then - sudo="sudo su --preserve-environment -c " + sudo su --preserve-environment -c "$@" else - sudo="su --preserve-environment -c " - fi - # extraction nb de tentatives éventuel - if [[ "$*" =~ :.{1,2}: ]]; then - nb="$*" - nb=${nb#*:} - nb=${nb%:*} - options=${*//:$nb:/ } - (( nb+1 )) 2>/dev/null || nb="$nbDefault" # test si numérique, sinon, - else - nb="$nbDefault" - options="$*" - fi - # lancement cmds - if [[ "$sudo" =~ ^sudo ]]; then - $sudo "$options" - else - for (( isudo=1 ; isudo<="$nb" ; isudo++ )); do - echo -en "\\n[su] Mot de passe root : " - $sudo "$options" 2>/dev/null && break - [ "$isudo" == "$nb" ] && return 1 - done - echo + echo -n "[su] " + su --preserve-environment -c "$@" fi } @@ -327,29 +295,31 @@ f_affichage(){ # 07/06/2018 } # affichage help -f_help(){ # 07/06/2018 +f_help(){ # 11/06/2018 tput cuu1 # une ligne plus haut cat <<- end - ---------------------------------------------------------------------- - canaux possibles:$GREEN latest, beta, nightly, dev, esr$STD - = tous les canaux + + canaux possibles:$GREEN latest, beta, nightly, dev, esr$STD ( = tous les canaux sauf dev ) + exemple, installation version Release (latest): $BLUE$script i-latest$STD + ---------------------------------------------------------------------- + $BLUE$script i-$STD${GREEN}canal :$STD ${RED}i${STD}nstallation de $appli $RED(root)$STD + $BLUE$script d-$STD${GREEN}canal :$STD copier un éventuel profil ${RED}.d${STD}efault existant sur + $BLUE$script m-$STD${GREEN}canal archi :$STD installation sur le d'une ve téléchargée ${RED}m${STD}anuellement $RED(root)$STD + $BLUE$script r-$STD${GREEN}canal :$STD désinstallation (${RED}r${STD}emove) du $RED(root)$STD + $BLUE$script ri$STD${GREEN} :$STD ${RED}r${STD}éparation$RED i${STD}cône(s) et lanceur(s) dans le menu $RED(root)$STD + $BLUE$script t-$STD${GREEN}canal :$STD téléchargement du dans le répertoire courant (sans installation) + $BLUE$script u-$STD${GREEN}canal :$STD profil pour l'${RED}u${STD}tilisateur en cours et comme défaut système $RED(root)$STD - $BLUE$script i-$STD${GREEN}canal$STD : ${RED}i${STD}nstallation de $appli $RED(root)$STD - avec option $GREEN--sauve$STD l'archive téléchargée est sauvegardée dans le répertoire courant + $BLUE$script p-$STD${GREEN}canal :$STD ${RED}p${STD}ersonnalisation sur le de user.js & userChrome.css + $BLUE$script pr-$STD${GREEN}canal :$STD suppression des ${RED}p${STD}ersonnalisations (${RED}r${STD}emove) sur le + $BLUE$script pu :$STD mise à jour des ${RED}p${STD}ersonnalisations (${RED}u${STD}pdate) installées - $BLUE$script d-$STD${GREEN}canal$STD : copier un éventuel profil ${RED}.d${STD}efault existant sur - $BLUE$script m-$STD${GREEN}canal archi$STD : installation sur le d'une ve téléchargée ${RED}m${STD}anuellement $RED(root)$STD - $BLUE$script r-$STD${GREEN}canal$STD : désinstallation (${RED}r${STD}emove) du $RED(root)$STD - $BLUE$script ri$STD : ${RED}r${STD}éparation$RED i${STD}cône(s) et lanceur(s) dans le menu $RED(root)$STD - $BLUE$script u-$STD${GREEN}canal$STD : profil pour l'${RED}u${STD}tilisateur en cours et comme défaut système $RED(root)$STD - - $BLUE$script p-$STD${GREEN}canal$STD : ${RED}p${STD}ersonnalisation sur le de user.js & userChrome.css - $BLUE$script pr-$STD${GREEN}canal$STD : suppression des ${RED}p${STD}ersonnalisations (${RED}r${STD}emove) sur le - $BLUE$script pu$STD : mise à jour des ${RED}p${STD}ersonnalisations (${RED}u${STD}pdate) installées - - $BLUE$script version$STD : versions installées et en ligne + $BLUE$script version :$STD versions installées et en ligne + + $GREEN --dev :$STD une version de dev du script (si existante) est recherchée + $GREEN --sauve :$STD le téléchargement est sauvegardé dans le répertoire courant ${BOLD}en$STD plus de l'installation ---------------------------------------------------------------------- $BLUE./$script$STD (ou $BLUE./$script -i$STD) : installation du script dans le système $RED(root)$STD $BLUE$script -h$STD, --help : affichage aide @@ -466,6 +436,7 @@ ffx_copie_default(){ # 22/12/2017 fi f__info "copie du profil default <$profileDefault> sur $canal" +# cp -R --preserve "$dirProfilFfx/$profileDefault/"* "$dirProfilFfx/$canal/" cp -R "$dirProfilFfx/$profileDefault/"* "$dirProfilFfx/$canal/" chown -R "$fu_user:" "$dirProfilFfx/$canal/" # propriété du répertoire profil à l'user chmod g-rx,o-rx "$dirProfilFfx/$canal/" # droits répertoire @@ -481,57 +452,67 @@ ffx_get_canalBas(){ # 18/12/2017 [ "$ffx_canal_bas" ] && return 0 || return 1 } - # version en ligne et installée, affichage -ffx_get_version(){ # 07/06/2018 - local recup_url ver_latest ver_esr ver_beta ver_nightly ii - local verFfxInstall='' verFfxOnline='' pointeur fileTmp="/tmp/$script-getVersion_ffx" + # version en ligne et installée, [$1=quiet], affichage & assigne : + # $ver_fx_latest $ver_fx_esr $ver_fx_esr_old $ver_fx_beta $ver_fx_nightly +ffx_get_version(){ # 12/06/2018 + local recup_url ii versOnline versionEsr ver_fx_esr_avertissement verFfxInstall='' verFfxOnline='' pointeur - echo -n " ." - #recup url + x_ffx_get_version=1 + [ "$1" != quiet ] && echo -n " ." # version latest & esr recup_url="https://www.mozilla.org/en-US/firefox/notes/" - if ! wget -q --tries=2 --timeout=15 --user-agent="$user_agent" -o /dev/null -O - "$recup_url" &>"$fileTmp" ; then + recup_url="https://www.mozilla.org/en-US/firefox/notes/" # alternatif + if versOnline=$( wget -q --tries=2 --timeout=15 --user-agent="$user_agent" -o /dev/null -O - "$recup_url" ); then + ver_fx_latest=${versOnline#*data-latest-firefox=\"} + ver_fx_latest=${ver_fx_latest%%\"*} + versionEsr=${versOnline#*data-esr-versions=\"} + mapfile -t -d ' ' versionEsr <<< "${versionEsr%%\"*}" + versionEsr=( "${versionEsr[@]%$'\n'}" ) + if (( ${#versionEsr[@]} > 1 )); then + ver_fx_esr=${versionEsr[1]} + ver_fx_esr_old=${versionEsr[0]} + ver_fx_esr_avertissement="nouvelle version esr" + else + ver_fx_esr=${versionEsr[0]} + fi + else f__wget_test "$recup_url" fi - ver_latest=$( grep -Eos 'data-latest-firefox="[0-9\.]+"' $fileTmp | grep -Eo '[0-9\.]+' ) - echo -n "." - ver_esr=$( grep -Eos 'data-esr-versions="[0-9\.]+"' $fileTmp | grep -Eo '[0-9\.]+' ) - echo -n "." + [ "$1" != quiet ] && echo -n "." # version beta recup_url="https://download.mozilla.org/?product=firefox-beta-latest&os=linux64&lang=fr" - if ! wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$recup_url" &>"$fileTmp" ; then + if versOnline=$( wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers -O - "$recup_url" 2>&1); then + ver_fx_beta=${versOnline#*releases\/} + ver_fx_beta=${ver_fx_beta%%\/*} + else f__wget_test "$recup_url" fi - ver_beta=$( grep -is 'location' $fileTmp | sed -E 's/.*firefox-(.*)\.tar.bz2/\1/' ) - echo -n "." + [ "$1" != quiet ] && echo -n "." # version nightly recup_url="https://download.mozilla.org/?product=firefox-nightly-latest-l10n-ssl&os=linux64&lang=fr" - if ! wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$recup_url" &>"$fileTmp" ; then + if versOnline=$( wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers -O - "$recup_url" 2>&1); then + ver_fx_nightly=${versOnline#*\/firefox-} + ver_fx_nightly=${ver_fx_nightly%%\.fr*} + else f__wget_test "$recup_url" fi - ver_nightly=$( grep -is 'location' $fileTmp | sed -E 's/.*firefox-(.*)\.fr.linux.*/\1/' ) - echo -n "." - rm -f "$fileTmp" - - [ "$ver_latest" ] || ver_latest="${RED}n/a" - [ "$ver_esr" ] || ver_esr="${RED}n/a" - [ "$ver_beta" ] || ver_beta="${RED}n/a" - [ "$ver_nightly" ] || ver_nightly="${RED}n/a" - - for ii in $produit_all; do - echo -n "+" + [ "$1" == "quiet" ] && return 0 + ver_fx_latest=${ver_fx_latest:="${RED}n/a$STD"} + ver_fx_esr=${ver_fx_esr:="${RED}n/a$STD"} + ver_fx_beta=${ver_fx_beta:="${RED}n/a$STD"} + ver_fx_nightly=${ver_fx_nightly:="${RED}n/a$STD"} + for ii in $produit_all esr_old; do # versions en ligne [ "$ii" == "dev" ] && continue - pointeur="ver_$ii" - verFfxOnline+=$( printf "%7s: %-7s " "$ii" "${!pointeur}" ) + pointeur="ver_fx_$ii" + verFfxOnline+=$( printf "%7s: %-7s " "$ii" "${!pointeur}" ) [[ "${!pointeur}" != "${RED}n/a" ]] && (( compteur++ )) - # versions installées if [ -x "$dirInstallFfx$ii/firefox" ]; then - verFfxInstall+=$( printf "%7s: %-7s " "$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 17) ) + verFfxInstall+=$( printf " %.s" $(seq 18) ) fi done @@ -546,60 +527,83 @@ ffx_get_version(){ # 07/06/2018 # ascii art godzilla # shellcheck disable=SC1117 -ffx_godzilla(){ # 07/06/2018 +ffx_godzilla(){ # 11/06/2018 echo -n "$RED" cat <<- end - _.-~-. - 7'' Q..\ - _7 (_ - _7 _/ _q. / - _7 . ___ /VVvv-'_ . - 7/ / /~- \_\\ '-._ .-' / // - ./ ( /-~-/||'=.__ '::. '-~'' { ___ / // ./{ - V V-~-~| || __''_ ':::. ''~-~.___.-'' _/ // / {_ / { / - VV/-~-~-|/ \ .'__'. '. ':: _ _ _ ''. - / /~~~~||VVV/ / \ ) \ _ __ ___ ___ ___(_) | | __ _ .::' - / (~-~-~\\.-' / \' \::::. | '_ ' _ \ / _ \_ / | | |/ _' | :::' - /..\ /..\__/ ' '::: | | | | | | (_) / /| | | | (_| | ::' - vVVv vVVv ': |_| |_| |_|\___/___|_|_|_|\__,_| '' + _.-~-. + 7'' Q..\ + _7 (_ + _7 _/ _q. / + _7 . ___ /VVvv-'_ . + 7/ / /~- \_\\ '-._ .-' / // + ./ ( /-~-/||'=.__ '::. '-~'' { ___ / // ./{ + V V-~-~| || __''_ ':::. ''~-~.___.-'' _/ // / {_ / { / + VV/-~-~-|/ \ .'__'. '. ':: _ _ _ ''. + / /~~~~||VVV/ / \ ) \ _ __ ___ ___ ___(_) | | __ _ .::' + / (~-~-~\\.-' / \' \::::. | '_ ' _ \ / _ \_ / | | |/ _' | :::' + /..\ /..\__/ ' '::: | | | | | | (_) / /| | | | (_| | ::' + vVVv vVVv ': |_| |_| |_|\___/___|_|_|_|\__,_| '' end echo "$STD" } # installation, $1 canal [$2='manuel', $3 archive] -ffx_install(){ # 07/06/2018 - local fileTemp canal="$1" verArchive dirTemp="/tmp/$script-install_ffx" +ffx_install(){ # 12/06/2018 + local fxVersion fileTemp canal="$1" versArchive dirTemp="/tmp/$script-install_ffx" - fileTemp="$dirTemp/flash_player_npapi-linux$(getconf LONG_BIT).tar.gz" + if [ ! -w "dirTemp" ]; then # utile si téléchargement et mauvais effacement précédent + dirtemp+="-$RANDOM" + [ ! -w "dirTemp" ] && f__error "droits insuffisants, recommencer avec les droits root" + fi if [ "$2" == "manuel" ]; then - verArchive=$( sed -E 's/.*firefox-(.*)\.linux.*$/\1/' <<< "$( basename "$3" )" ) - f__info "installation manuelle dans $canal de $appli version $verArchive ($( basename "$3" ))" + versArchive=$( sed -E 's/.*firefox-(.*)\.linux.*$/\1/' <<< "$( basename "$3" )" ) + f__info "installation manuelle dans $canal de $appli version $versArchive ($( basename "$3" ))" fileTemp="$3" mkdir -p "$dirTemp" else - f__info "installation $appli-$canal" - fileTemp="$dirTemp/${appli,,}-$canal.$fu_archi.tar.bz2" + [ -z "$dl_only" ] && f__info "installation $appli-$canal" + (( x_ffx_get_version == 1 )) || ffx_get_version quiet + mkdir -p "$dirTemp" + case "$1" in + latest ) fxVersion="$ver_fx_latest" ;; + beta ) fxVersion="$ver_fx_beta" ;; + nightly ) fxVersion="$ver_fx_nightly" ;; + esr ) fxVersion="$ver_fx_esr" + [ "$ver_fx_esr_avertissement" ] && f__info raw "nouvelle version ESR, avec de possibles points de non-retour" \ + "appuyer sur une touche pour continuer" + read -n1 -rs ;; + esr_old ) fxVersion="$ver_fx_esr_old" ;; + esac + fileTemp="$dirTemp/${appli,,}-${fxVersion}_$canal.$fu_archi.tar.bz2" # téléchargement & test archive f__info " - téléchargement..." # url téléchargement - if [ "$canal" == "latest" ]; then - recup_url="https://download.mozilla.org/?product=firefox-$canal&os=$fu_archi&lang=fr" - elif [ "$canal" == "esr" ] || [ "$canal" == "beta" ]; then - recup_url="https://download.mozilla.org/?product=firefox-$canal-latest&os=$fu_archi&lang=fr" - elif [ "$canal" == "dev" ]; then - recup_url="https://download.mozilla.org/?product=firefox-$canal""edition-latest-ssl&os=$fu_archi&lang=fr" - elif [ "$canal" == "nightly" ]; then - recup_url="https://download.mozilla.org/?product=firefox-$canal-latest-l10n-ssl&os=$fu_archi&lang=fr" - fi - mkdir -p "$dirTemp" - if ! wget -q -c --show-progress --tries=2 --timeout=15 --user-agent="$user_agent" -o /dev/null -O "$fileTemp" "$recup_url" ; then - f__wget_test "$recup_url" + case "$canal" in + latest ) recup_url="https://download.mozilla.org/?product=firefox-$canal&os=$fu_archi&lang=fr" ;; + esr | beta ) recup_url="https://download.mozilla.org/?product=firefox-$canal-latest&os=$fu_archi&lang=fr" ;; + dev ) recup_url="https://download.mozilla.org/?product=firefox-$canal""edition-latest-ssl&os=$fu_archi&lang=fr" ;; + nightly ) recup_url="https://download.mozilla.org/?product=firefox-$canal-latest-l10n-ssl&os=$fu_archi&lang=fr" ;; + esac + # téléchargement + if ! wget -q -c --show-progress --tries=2 --timeout=15 --user-agent="$user_agent" \ + -o /dev/null -O "$fileTemp" "$recup_url" ; then + f__wget_test "$recup_url" fi fi f__archive_test "$fileTemp" || f__error "Le fichier $fileTemp n'est pas une archive tar.gz valide" echo - # décompression archive téléchargée dans dossier de travail + if [[ "$dl_to_svg" || "$dl_only" ]]; then + chown "$fu_user:" "$fileTemp" + cp --preserve "$fileTemp" ./ + fi + if [ "$dl_only" ]; then + rm -fr "$fileTemp" + echo + return 0 + fi + + # décompression archive téléchargée dans dossier de travail f__info " - décompression..." tar -xaf "$fileTemp" -C "$dirTemp/" @@ -612,10 +616,6 @@ ffx_install(){ # 07/06/2018 chown -R "$fu_user:" "$dirInstallFfx$canal/" chmod -R g+wrs,a+r "$dirInstallFfx$canal/" # svg éventuelle archive, effacement répertoire temporaire - if [ "$dl_to_svg" == "ok" ]; then - chown "$fu_user:" "$fileTemp" - mv "$fileTemp" ./ - fi rm -fr "$dirTemp" # traitement finaux système @@ -637,11 +637,9 @@ ffx_install(){ # 07/06/2018 ffx_config_profil "$canal" # traitement de profile.ini ffx_config_system "$canal" # lien /usr/bin, alternatives, default dans le profile - if [ "$2" == "manuel" ]; then - f__info "log" "archive $appli-$canal $verArchive installée" - else - f__info "log" "$appli-$canal installé" - fi + [ "$1" != "manuel" ] && versArchive=$fxVersion + echo + f__info "log" "$appli-$canal $versArchive installé" ffx_godzilla } @@ -822,10 +820,10 @@ ffx_remove(){ # 09/03/2018 } # anacron hebdomadaire, via cron horaire, $1=upgrade|install|remove -fscript_cronAnacron(){ # 07/03/2018 +fscript_cronAnacron(){ # 11/06/2018 local dirAnacron dirSpool fileAnacron - type -t fscript_cronAnacron_special &>/dev/null && fscript_cronAnacron_special # test, si fonction spécifique, appel + type -t fscript_cronAnacron_special &>/dev/null && fscript_cronAnacron_special # test, si fonction spécifique, appel dirAnacron="/home/$fu_user/.config/anacron" dirSpool="$dirAnacron/spool" fileAnacron="$dirAnacron/$script.anacrontab" @@ -837,7 +835,7 @@ fscript_cronAnacron(){ # 07/03/2018 echo "7 10 $script nice $script_install --upgrade 1>/dev/null" > "$fileAnacron" # juste erreurs en syslog ## anacron journalier pour dev logname if [ -e "$fileDev" ]; then - echo "1 00 $script""Dev nice $script_install --upgrade 1>/dev/null" >> "$fileAnacron" + echo "1 00 ${script}Dev nice $script_install --upgrade 1>/dev/null" >> "$fileAnacron" fi # création spool anacron utilisateur mkdir -p "$dirSpool" @@ -849,7 +847,7 @@ fscript_cronAnacron(){ # 07/03/2018 grep -q "$script" "/etc/crontab" || echo f__error "inscription crontab" ;; remove ) - rm -f "${dirSpool:?}/$script"* 2>/dev/null + rm -f "${dirSpool:?}/$script"* rm -f "$fileAnacron" rmdir "$${dirSpool:?}" "${dirAnacron:?}" 2>/dev/null ;; @@ -857,53 +855,64 @@ fscript_cronAnacron(){ # 07/03/2018 } # assigne $ver_script_install, $ver_script_online, $script_a_jour=ok|KO -fscript_get_version(){ # 07/06/2018 - x_script_get_version=1 +fscript_get_version(){ # 09/06/2018 + x_script_get_version=1 # version online - if ! ver_script_online=$( wget -q --timeout=15 -o /dev/null -O - "$url_script" | grep -m1 '^version=' | cut -d'=' -f2 ); then + if ver_script_online=$( wget -q --timeout=15 -o /dev/null -O - "$url_script" ); then + ver_script_online=${ver_script_online#*version=} + read -r ver_script_online <<< "$ver_script_online" + else f__wget_test "$url_script" fi # version installée if [ -e "$script_install" ]; then - ver_script_install=$( grep -m1 '^version=' "$script_install" | cut -d'=' -f2 ) + while read -r ; do + if [[ "$REPLY" =~ ^version= ]]; then + ver_script_install=${REPLY#*=} + fi + done < "$script_install" fi - + # maj ? if [[ "$ver_script_online" && "$script_install" ]]; then - [ "$ver_script_install" != "$ver_script_online" ] && script_a_jour="KO" || script_a_jour="ok" + if [ "$ver_script_install" != "$ver_script_online" ]; then + script_a_jour="KO" + else + script_a_jour="ok" + fi fi - [ "$ver_script_online" ] || ver_script_online="${RED}n/a" - [ "$ver_script_install" ] || ver_script_install="Non installé" - + # affichage + ver_script_online=${ver_script_online:="${RED}n/a$STD"} + ver_script_install=${ver_script_install:="Non installé"} f__info "raw" "script en place: $GREEN$ver_script_install" f__info "script en ligne: $YELLOW$ver_script_online" } -fscript_install(){ # 24/02/2018 +fscript_install(){ # 09/06/2018 if grep -Eq "$script_install|/usr/bin/$script" <<< "$0"; then f__info "${RED}l'installation dans le système doit se faire depuis le script non installé $GREEN(./$script -i )" return 1 fi - type -t fscript_install_special &>/dev/null && fscript_install_special # test, si fonction spécifique, appel + type -t fscript_install_special &>/dev/null && fscript_install_special # test, si fonction spécifique, appel f__requis "wget anacron cron" || exit 1 # install /opt mkdir -p /opt/bin/ - cp -d "$0" "$script_install" - ln -s "$script_install" "/usr/bin/$script" &>/dev/null - chmod 775 "$script_install" # rwx rwx r-x, proprio fu_user + cp "$0" "$script_install" + ln -s "$script_install" "/usr/bin/$script" 2>/dev/null + chmod 755 "$script_install" # cron/anacron install fscript_cronAnacron "install" # création fichier log touch "$script_logs" - chmod 664 "$script_logs" # rw- rw- r--, proprio fu_user + chmod 644 "$script_logs" chown "$fu_user:" "$script_logs" "$script_install" [ -e "$fileDev" ] || rm -f "$0" ## on efface pas si fileDev (dev) f__info "log" "$script $version installé dans le système." "maintenant, appel du script par: $GREEN$script$BLUE (sans ./)" } -fscript_remove(){ # 24/02/2018 +fscript_remove(){ # 09/06/2018 if ! grep -Eq "$script_install|/usr/bin/$script" <<< "$0"; then f__info "${RED}cette fonction doit être appelée depuis le script installé dans le système $GREEN($script -r)" @@ -914,21 +923,22 @@ fscript_remove(){ # 24/02/2018 return 1 fi - type -t fscript_remove_special &>/dev/null && fscript_remove_special # test, si fonction spécifique, appel + type -t fscript_remove_special &>/dev/null && fscript_remove_special # test, si fonction spécifique, appel # suppression /opt, lien /usr/bin rm -f "$script_install" - unlink "/usr/bin/$script" &>/dev/null + unlink "/usr/bin/$script" 2>/dev/null # cron/anacron remove fscript_cronAnacron "remove" f__info "log" "$script $version supprimé du système." } - # si upgrade en place, $1 != "", [$1 message info] -fscript_update(){ # 07/06/2018 - local dirTemp="/tmp/$script-maj" upgradeEnPlace="$1" + # $1: update standard $1=std, si update en place $1=message d'info +fscript_update(){ # 11/06/2018 + local dirTemp="/tmp/$script-maj" upgradeEnPlace - type -t fscript_update_special &>/dev/null && fscript_update_special # test, si fonction spécifique, appel + [ "$1" != 'std' ] && upgradeEnPlace="$1" + type -t fscript_update_special &>/dev/null && fscript_update_special # test, si fonction spécifique, appel if [ -z "$upgradeEnPlace" ] && ! grep -Eq "$script_install|/usr/bin/$script" <<< "$0"; then f__info "${RED}cette fonction doit être appelée depuis le script installé dans le système $GREEN($script -u)" return 1 @@ -946,8 +956,8 @@ fscript_update(){ # 07/06/2018 f__wget_test "$url_script" fi if grep -q '#!/bin/bash' "$dirTemp/$script" && grep -q '^### END CONTROL' "$dirTemp/$script"; then - cp -d "$dirTemp/$script" "$script_install" - chmod 775 "$script_install" # rwx rwx r-x, proprio fu_user + cp "$dirTemp/$script" "$script_install" + chmod 755 "$script_install" chown "$fu_user:" "$script_install" [ -z "$upgradeEnPlace" ] && fscript_cronAnacron "upgrade" f__info "log" "$script mis à jour en version $ver_script_online $upgradeEnPlace" @@ -995,12 +1005,13 @@ prg_init(){ # 07/06/2018 f__color } + ######## début script / initialisation # tests ou initialisation au démarrage prg_init - # logo et définition couleurs + # logo f_affichage # paramètres script @@ -1039,95 +1050,88 @@ elif [[ "$urlPersoEnPlace" && "$urlPersoEnPlace" != "$urlPersFfx" ]]; then # ur urlPersFfx="$urlPersoEnPlace" fi -options="$*" +script_options="$*" + # options +while (( $# )) ; do + case "$1" in + --sauve ) dl_to_svg="ok" ;; + --dev ) url_script=${url_script//\/master\///dev/} ;; + * ) options+=( "$1" ) ;; + esac + shift +done + # auto-installation script éventuel, si pas de marqueur $fileDev if [[ $( dirname "$0" ) != $( dirname "$script_install" ) && $( dirname "$0" ) != "/usr/bin" && ! -e "$fileDev" ]]; then - options="-i" # option installation script + options=( -i ) # option installation script fi -[ "$options" ] || options="-h" # vide help (si fileDev) +(( ${#options} == 0 )) && options=( -h ) # vide help (si fileDev), sinon install -for j in $options; do # première passe options - case $j in - --sauve ) - dl_to_svg="ok" - ;;& - esac -done -options=${options//--sauve/ } - -# shellcheck disable=SC2221,SC2222 -for j in $options; do # deuxième passe options, actions - case $j in + #actions +for i in "${!options[@]}"; do # deuxième passe options, actions + produit=${options[$i]#*-} + # shellcheck disable=SC2221,SC2222 + case ${options[$i]} in -i | --install | -r | --remove | ri | i-* | m-* | r-* | u-* ) if [ "$EUID" -ne 0 ]; then - f__info "vous devez être$RED ROOT$BLUE pour cette opération" - f__sudo "exec $0 $*" + f__info raw "vous devez être$RED ROOT$BLUE pour cette opération" + f__sudo "exec $0 $script_options" exit - fi - ;;& + fi ;;& d-latest | d-esr | d-dev | d-beta | d-nightly | d-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all" for k in $produit; do ffx_copie_default "$k" # copier un profil default sur un canal - done - ;; + done ;; i-latest | i-esr | i-dev | i-beta | i-nightly | i-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all_inverse" for k in $produit; do ffx_install "$k" # installation canal - done - ;; + done ;; m-latest | m-esr | m-dev | m-beta | m-nightly ) - produit=${j#*-} - ffx_install_manuel "$produit" "$2" # installation manuelle d'une archive, $2=archive + ffx_install_manuel "$produit" "${options[((i+1))]}" # installation manuelle d'une archive, $2=archive exit ;; p-latest | p-esr | p-dev | p-beta | p-nightly | p-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all" for k in $produit; do ffx_pers_install "$k" # personnalisation - done - ;; + done ;; pr-latest | pr-esr | pr-dev | pr-beta | pr-nightly | pr-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all" for k in $produit; do ffx_pers_remove "$k" # personnalisation remove - done - ;; + done ;; pu ) ffx_pers_upgrade # mise à jour personnalisations ;; r-latest | r-esr | r-dev | r-beta | r-nightly | r-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all" for k in $produit; do # remove canal ffx_remove "$k" - done - ;; + done ;; ri ) produit="$produit_all" for k in $produit; do ffx_lanceur_desktop "$k" # réparation icône de tous les canaux installés - done - ;; + done ;; + t-latest | t-esr | t-dev | t-beta | t-nightly | t-all ) + [ "$produit" == "all" ] && produit="$produit_all" + for k in $produit; do + dl_only="ok" + ffx_install "$k" # téléchargement canal + done ;; u-latest | u-esr | u-dev | u-beta | u-nightly | u-all ) - produit=${j#*-} [ "$produit" == "all" ] && produit="$produit_all" for k in $produit; do ffx_config_profil "$k" "menu" # configurer un canal pour user en cours ffx_config_system "$k" # défaut système echo - done - ;; + done ;; version | versions ) # versions en ligne & installées fscript_get_version ffx_get_version - ffx_pers_get_version - ;; + ffx_pers_get_version ;; -i | --install ) # installation du script dans le système fscript_install @@ -1137,15 +1141,13 @@ for j in $options; do # deuxième passe options, actions exit ;; -u | --upgrade ) # upgrade script & personnalisations operation="upgrade" - fscript_update - ffx_pers_upgrade + fscript_update std # std argument obligatoire pour upgrade normal + ffx_pers_upgradeq exit ;; -v | --version ) # version du script, en ligne et en place - fscript_get_version - ;; + fscript_get_version ;; -h | --help | * ) # affichage help - f_help - ;; + f_help ;; esac done @@ -1153,7 +1155,9 @@ exit ### END CONTROL (contrôle chargement) -wget -nv -O getFirefox https://framagit.org/sdeb/getFirefox/raw/master/getFirefox +wget -nv -O getFirefox https://framaclic.org/h/getfirefox +curl -L -o getFirefox https://framaclic.org/h/getfirefox chmod +x getFirefox && ./getFirefox -wget -O getFirefox https://framaclic.org/h/getfirefox +wget -nv -O getFirefox https://framagit.org/sdeb/getFirefox/raw/master/getFirefox +curl -LO https://framagit.org/sdeb/getFirefox/raw/master/getFirefox diff --git a/scripts/getFlashPlayer b/scripts/getFlashPlayer index 8a87dfb..554841b 100755 --- a/scripts/getFlashPlayer +++ b/scripts/getFlashPlayer @@ -1,6 +1,6 @@ #!/bin/bash -version=4.12.0 +version=4.13.O date="12/06/2018" script="getFlashPlayer" # contact="IRC ##sdeb@freenode.net ou https://framagit.org/sdeb/getFlashPlayer/issues" @@ -361,7 +361,6 @@ fflash_install(){ # 12/06/2018 dirtemp+="-$RANDOM" [ ! -w "dirTemp" ] && f__error "droits insuffisants, recommencer avec les droits root" fi - mkdir -p "$dirTemp" [[ "$operation" != "upgrade" && -z "$dl_only" ]] && fflash_avertissement if [ "$1" == "manuel" ]; then versArchive=${2%\.tar*} # flashplayer_28.0.0.137_npapi_linux64.tar.gz @@ -369,9 +368,11 @@ fflash_install(){ # 12/06/2018 versArchive=${versArchive#*_} f__info "installation manuelle de FlashPlayer version $versArchive ($2)" fileTemp="$2" + mkdir -p "$dirTemp" else (( x_get_version == 1 )) || fflash_get_version "quiet" [ -z "$dl_only" ] && f__info "installation FlashPlayer, version $ver_flash" + mkdir -p "$dirTemp" fileTemp="$dirTemp/flashplayer_${ver_flash}_npapi_linux$( getconf LONG_BIT ).tar.gz" # détection/chargement/test archive plugin flashplayer f__info " - téléchargement..."