This commit is contained in:
kyodev 2017-07-14 18:40:49 +02:00
parent d66f359526
commit 00ffc1c372
2 changed files with 30 additions and 14 deletions

View File

@ -1,12 +1,12 @@
#!/bin/bash
version=2.2.0
version=2.3.0
date="14/07/2017"
projet="Kyodev"
contact="https://framagit.org/kyodev/kyopages/issues"
script="getFlashPlayer"
urlScript="https://framagit.org/kyodev/kyopages/raw/master/scripts/getFlashPlayer"
user_agent="Mozilla/5.0 (X11; Linux $architecture; rv:54.0) Gecko/ Firefox"
user_agent="Mozilla/5.0 (X11; Linux $(uname -m); rv:54.0) Gecko/20100101 Firefox/54.0"
##### license LPRAB/WTFPL
# auteurs: kyodev
@ -14,6 +14,8 @@ user_agent="Mozilla/5.0 (X11; Linux $architecture; rv:54.0) Gecko/ Firefox"
# idée: naguam
#####
PATH='/bin:/usr/bin' ; IFS=' '
#### définition couleurs -----------------------------------------------
YELLOW=`printf "\033[0;33m"` # ?
GREEN=`printf "\033[0;32m"` # ok
@ -121,7 +123,7 @@ fscript_install(){
chmod a+wx "$(basename $0)"
cp -d "$(basename $0)" /opt/bin/"$script"
fi
## rm "$(basename $0)" &>/dev/null
[ -f "$script"_changelog.md ] || rm "$(basename $0)" &>/dev/null ## on efface pas si changelog (dev)
f__info "$GREEN$script est installé dans le système.\n$BLUE maintenant, appel du script par:$GREEN $script$BLUE (sans ./)"
exit 0
}
@ -250,33 +252,40 @@ EOF
printf $COLOR
}
# calcul url téléchargement plugin
fflash_detect_url(){
#v2 07/2017
recup="$(wget --tries=2 --timeout=15 --user-agent="$user_agent" -qO - "$urlOnline" | grep -o '#buttonDownload.*(\.tar\.gz).*$')"
recup1="$(echo $recup | sed 's/.*\(download.*Linux_\).*/\1/')"
recup2="$(echo $test | sed 's/.*\(-bit.*standalone=1\).*/\1/')"
recup_url="$urlOnline$recup1$(getconf LONG_BIT)$recup2"
#https://get.adobe.com/fr/flashplayer/download/?installer=FP_26.0_for_Linux_32-bit_(.tar.gz)_-_NPAPI&sType=6627&standalone=1
}
# install plugin dans config user mozilla, $1 upgrade|manuel (maj|install manuelle)
fflash_install(){
if [ $1 != "upgrade" ]; then fflash_avert; fi
architecture="$(getconf LONG_BIT)" # 32 | 64
if [ $1 == "manuel" ]; then
file="$(basename $2)"
dirTemp="$(dirname $2)/$script-$RANDOM/"
mkdir -p "$dirTemp"
else
# calcul $file, affichage version pendant l'install, calcul $url
file="flashplayer_npapi_linux.$architecture.tar.gz"
# calcul $file, affichage version pendant l'install
file="flashplayer_npapi_linux.$(getconf LONG_BIT).tar.gz"
if [ $verFlash == "na" ] || [ $verFlash == "" ]; then fflash_version; fi
f__info "installation FlashPlayer, version $verFlash"
verFlash_major="$(echo $verFlash | cut -d '.' -f 1-2)"
url2="https://get.adobe.com/fr/flashplayer/download/?installer=FP_""$verFlash_major""_for_Linux_""$architecture"
url2="$url2""-bit_(.tar.gz)_-_NPAPI&sType=6625&standalone=1"
# dossier temporaire de travail, création
dirTemp="/tmp/$script-$RANDOM/"
mkdir -p "$dirTemp"
# chargement archive plugin flashplayer
wget -cq --show-progress --no-check-certificate --user-agent="$user_agent" --referer="$urlOnline" \
--tries=1 -O "$dirTemp$file" "$url2"
fflash_detect_url
wget -c -nv --user-agent="$user_agent" --referer="$urlOnline" \
-o "$dirTemp"wget.log --tries=1 -O "$dirTemp$file" "$recup_url"
if [ "$?" != "0" ]; then
f__testWget "$url2"
f__testWget "$recup_url"
f__error "Erreur wget\n" \
" réessayer et si persistance, contacter $projet $contact\n en indiquant les erreurs précédentes."
fi
@ -342,7 +351,7 @@ dirname "$0" | grep 'bin' &>/dev/null || fscript_install
case "$1" in
"install" )
fflash_install ;; # installation plugin
fflash_install "install";; # installation plugin
"remove" )
fflash_remove ;; # désinstallation plugin
"version" )

View File

@ -1,7 +1,14 @@
# changelog getFlashPlayer
## 2. 14/07/2017
## 2.2.1 14/07/2017
* fix mineur
* déclaration PATH & IFS
* fix détection changement url
* BUG erreur chargement -> wget?
## 2.2.0 14/07/2017
* bug fix mauvaise détection paquet flashplugin-nonfree installé
* mieux installation script optimisée lors mise à jour