getInfo 4.3.0

This commit is contained in:
kyodev 2018-03-09 17:11:49 +01:00
parent 970c9ae2f9
commit 4c7164fdd7
2 changed files with 18 additions and 15 deletions

View File

@ -1,9 +1,9 @@
#!/bin/bash
# shellcheck disable=SC1091,SC2016,SC2009,SC2119,SC2129
# shellcheck disable=SC1091,SC2009,SC2016,SC2119,SC2129
# SC1091 Not following (source)
# SC2016 Expressions don't expand in single quotes
# SC2009 Consider using pgrep instead of grepping ps output
# SC2016 Expressions don't expand in single quotes
# SC2119 Use function "$@" if function's $1 should mean script's $1 (??)
# SC2129 Consider using { cmd1; cmd2; } >> file ... (erreur détection?)
@ -12,7 +12,6 @@ date="08/03/2018"
contact="IRC freenode.net ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo"
##### license LPRAB/WTFPL
# auteur: simpledeb
# contributeurs: kyodev, saiqui, naguam, agentcobra, amilcar
@ -177,10 +176,10 @@ 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(){ # 05/03/2018
f__requis(){ # 09/03/2018
local ENV_DEBIAN ireq table package commands command commandsMissing packagesMissing
if type -p "dpkg" &>/dev/null ; then
if type -p dpkg &>/dev/null ; then
ENV_DEBIAN="oui" # debian
fi
if type -t f__info &>/dev/null; then
@ -228,11 +227,11 @@ f__requis(){ # 05/03/2018
# recherche paquet deb (scission f__requis), $1 liste paquets ("paquet1 paquet2"), si un paquet absent return 1
# assigne $deb_absent & $deb_present, si hors debian: return 1 mais $deb_present & $deb_absent vides
f__requis_deb(){ # 05/03/2018
f__requis_deb(){ # 09/03/2018
local ireq
unset deb_present deb_absent
type -p "dpkg" &>/dev/null || return 1 # si pas dpkg, sortie return 0
type -p dpkg &>/dev/null || return 1 # si pas dpkg, sortie return 0
for ireq in $1; do
LC_ALL=C dpkg --get-selections | grep -qE "^$ireq[[:space:]]+install" \
@ -401,9 +400,9 @@ f__user(){ # 08/03/2018
# $1='-w' comptage dans variable $2 des mots
# $1='-wv' comptage dans variable $2, des mots $3, affiche quantité
# f__wcv -l $var ; f__wcv -w $var ; f__wcv -wv $var "mot"
f__wcv(){ # 28/02/2018
f__wcv(){ # 09/03/2018
[[ "$1" =~ -l|-wv|-w ]] || display="erreur f__wcv \$1 ($1) incorrect \n"
[[ "$1" =~ -l|-wv|-w ]] || echo "erreur f__wcv \$1 ($1) incorrect"
if [ "$1" == "-l" ]; then
grep -cEv '^[[:space:]]*$' <<< "$2" # (wc -l compterait 1 pour une variable vide)
elif [ "$1" == "-w" ]; then
@ -468,7 +467,7 @@ f__wget_test(){ # 22/02/2018
exit 0
}
f_affichage(){ # 24/01/2018
f_affichage(){ # 09/03/2018
local affichage_text=" _ ___ __
__ _ ___| |_|_ _|_ __ / _| ___
/ _' |/ _ \ __|| || '_ \| |_ / _ \
@ -476,6 +475,8 @@ f_affichage(){ # 24/01/2018
\__, |\___|\__|___|_| |_|_| \___/
|___/"
(( x_logo == 1 )) && return
x_logo=1
clear
echo -e "$BLUE$affichage_text$YELLOW version $version - $date$STD\n"
}
@ -4568,7 +4569,9 @@ fscript_remove(){ # 24/02/2018
}
# si upgrade en place, $1 != "", [$1 message info]
fscript_update(){ # 07/03/2018
# shellcheck disable=SC2120
# function references arguments, but none are ever passed.
fscript_update(){ # 09/03/2018
local dirTemp="/tmp/$script-maj" upgradeEnPlace="$1"
type -t fscript_update_special &>/dev/null && fscript_update_special # test, si fonction spécifique, appel
@ -4585,7 +4588,7 @@ fscript_update(){ # 07/03/2018
fi
mkdir -p "$dirTemp"
if ! wget -q --tries=2 --timeout=15 -o /dev/null -O "$dirTemp/$script" "$url_script"; then
rm -fr "${dirTemp:?}"
rm -fr "$dirTemp"
f__wget_test "$url_script"
fi
if grep -q '#!/bin/bash' "$dirTemp/$script" && grep -q '^### END CONTROL' "$dirTemp/$script"; then
@ -4597,7 +4600,7 @@ fscript_update(){ # 07/03/2018
else
f_info "log" "$script: échec update" "mauvais téléchargement, réessayer plus tard"
fi
rm -fr "${dirTemp:?}"
rm -fr "$dirTemp"
}
prg_init(){ # 06/03/2018
@ -4678,7 +4681,7 @@ prg_init(){ # 06/03/2018
fi
# détection rapide systeme deb
type -p "dpkg" &>/dev/null && ENV_DEBIAN="oui"
type -p dpkg &>/dev/null && ENV_DEBIAN="oui"
# définition couleurs
f__color

View File

@ -1,11 +1,11 @@
# changelog getInfo
## getInfo 4.3.0 08/03/2018
* lint: shellcheck
* lift: suppression f__which, quelques optimisations vitesse
* révision: f_affichage
* révision: figet_disk, fi_disk
* révision: figet_ip_pub, +f__test_cnx
* révision: f_grep_file (fstab)