mirror of https://framagit.org/kyodev/kyopages.git
1.15.0
This commit is contained in:
parent
4e0c278be2
commit
c957660271
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=1.14.0
|
||||
date="06/09/2017"
|
||||
version=1.15.0
|
||||
date="07/09/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
script="getInfo"
|
||||
|
@ -71,7 +71,7 @@ f__info() { # v25/08/2017
|
|||
}
|
||||
|
||||
# log spécifique, fichier log limité à 10000octets, $1 message à loguer
|
||||
f__log(){ # v08/2017
|
||||
f__log(){ # v08/O9/2017
|
||||
if [ -w "$fileLogs" ]; then
|
||||
if [ "$(stat -c %s $fileLogs)" -ge "10000" ]; then
|
||||
echo "$(date +%Y%m%d\ %H%M%S) $1" &>/dev/null > "$fileLogs"
|
||||
|
@ -79,7 +79,8 @@ f__log(){ # v08/2017
|
|||
echo "$(date +%Y%m%d\ %H%M%S) $1" &>/dev/null >> "$fileLogs"
|
||||
fi
|
||||
else
|
||||
f__info "$fileLogs doit être activé"
|
||||
f__info "$fileLogs doit être activé" "Réinstaller un script plus récent" \
|
||||
"voir $GREEN""$urlNotice#installation-rapide-du-script"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,8 @@ f__user(){ # v30/08/2017-4
|
|||
|
||||
# test wget, $1 url à tester, sortie script, sur erreur ou retour à la normale
|
||||
# si $2=print affiche url testée & entêtes http & location (si présente) et sortie normale fonction
|
||||
f__wget_test(){ # v31/08/2017
|
||||
# si $2=loc affiche seulement location
|
||||
f__wget_test(){ # v07/09/2017
|
||||
local file_test_wget retourWget retourHttp location
|
||||
file_test_wget="/tmp/testWget-$RANDOM"
|
||||
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || retourWget="$?"
|
||||
|
@ -165,11 +167,22 @@ f__wget_test(){ # v31/08/2017
|
|||
[ "$retourWget" == 8 ] && retourWget="réponse serveur en erreur"
|
||||
retourHttp="$(grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs)"
|
||||
location="$(grep -i 'location' $file_test_wget | xargs)"
|
||||
if [ "$2" == "print" ] && [ -z "$retourWget" ]; then
|
||||
echo -e "\n$BLUE$1"
|
||||
echo "$GREEN$retourHttp$COLOR"
|
||||
[ "$location" ] && echo "$YELLOW$location"
|
||||
echo "$COLOR"
|
||||
if [ "$2" == "print" ]; then
|
||||
if [ "$retourWget" ]; then
|
||||
echo "erreur wget: $RED$retourWget$COLOR"
|
||||
echo -e "$BLUE $1$COLOR\t$RED $retourHttp$COLOR"
|
||||
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOW no location"
|
||||
echo "$COLOR"
|
||||
return
|
||||
else
|
||||
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$YELLOW"
|
||||
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOW no location"
|
||||
echo "$COLOR"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if [ "$2" == "loc" ]; then
|
||||
[ "$location" ] && echo "$location" || echo "no location"
|
||||
return
|
||||
fi
|
||||
if [ "$retourWget" ]; then
|
||||
|
@ -182,7 +195,7 @@ f__wget_test(){ # v31/08/2017
|
|||
exit 0
|
||||
}
|
||||
|
||||
f_help(){
|
||||
f_help(){ # v07/09/2017
|
||||
printf "$BLUE"
|
||||
cat << 'EOF'
|
||||
----------------------------------------------------------------------
|
||||
|
@ -207,7 +220,7 @@ cat << 'EOF'
|
|||
-u, --upgrade : upgrade script si maj possible
|
||||
-v, --version : version du script, en ligne et en cours d'exécution
|
||||
EOF
|
||||
printf "$COLOR\n"
|
||||
echo -e "$COLOR\n plus d'infos: $GREEN$urlNotice$COLOR\n"
|
||||
}
|
||||
|
||||
# assigne $context_appli, context_break
|
||||
|
@ -1044,8 +1057,7 @@ fscript_cronAnacron(){ # v06/09/2017
|
|||
}
|
||||
|
||||
# version script en ligne, assigne $versionScript, $script_aJour=ok|ko
|
||||
fscript_get_version(){ # v27/08/2017
|
||||
f__requis "wget"
|
||||
fscript_get_version(){ # v07/09/2017
|
||||
f__info "raw" "$GREEN""version script en cours: $version"
|
||||
versionScript="$(wget -q --tries=2 --timeout=15 -O - "$urlScript" | grep '^version=' | cut -d '=' -f 2)"
|
||||
if [ "$versionScript" ]; then
|
||||
|
@ -1056,7 +1068,7 @@ fscript_get_version(){ # v27/08/2017
|
|||
f__info "version script en ligne: $versionScript"
|
||||
script_aJour="ok"
|
||||
fi
|
||||
else f__info "version script en ligne non accessible"; fi
|
||||
else f__info "version script en ligne $RED""non accessible"; fi
|
||||
}
|
||||
|
||||
# installation du script dans le système
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
## todo
|
||||
|
||||
## 1.15.0 07/09/2017
|
||||
|
||||
* correction f_help
|
||||
* révision f__wget_test, fscript_get_version, f__log
|
||||
|
||||
## 1.14.0 06/09/2017
|
||||
|
||||
* maj fscript_cronAnacron, fscript_update, fscript_install, fscript_remove
|
||||
|
|
Loading…
Reference in New Issue