getInfo 2.40.2

This commit is contained in:
kyodev 2017-11-19 21:16:02 +01:00
parent b74728597e
commit c5912088ed
2 changed files with 43 additions and 36 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.40.1
version=2.40.2
date="19/11/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -357,7 +357,7 @@ f_display(){ # 17/11/2017
# $1 variable à afficher en alerte/info, [$2 alert|info] type de message, alert par défaut
# passage en paramètre variable et pas $variable
# un test si variable $1 est vide ou non est fait
f_dspl_alert(){ # 15/11/2017
f_dspl_alert(){ # 19/11/2017
[ "${!1}" ] || return 0 # test si contenu dans $1
local display type
# flush, avant fonction, de $text parent
@ -367,8 +367,8 @@ f_dspl_alert(){ # 15/11/2017
[[ "$2" =~ info ]] && type="info"
[[ "$2" =~ alert ]] && type="alert"
[ "$2" ] || type="alert" # alert par défaut
[ "$type" == "alert" ] && display="> ↯ ${!1} \n\n"
[ "$type" == "info" ] && display=" ☛ ${!1} \n\n"
[ "$type" == "alert" ] && display="> ↯ ${!1} \n\n\n"
[ "$type" == "info" ] && display=" ☛ ${!1} \n\n\n"
echo -en "$display" >> "$fileOutput" # flush fonction
}
@ -523,8 +523,8 @@ fi_batt(){ # 10/11/2017
unset text
}
fi_cpu(){ # 10/11/2017
local cpu_flags text iflag var_temp text_flags="" pluriel
fi_cpu(){ # 19/11/2017
local cpu_flags text iflag var_temp qte_flags text_flags="" pluriel
cpu_flags=$(sed -n 's/^flags.*: \(.*\)$/\1/p;' /proc/cpuinfo | sed -n '1p'| \
tr ' ' '\n' | sort | tr '\n' ' ' | xargs )
fi_cpu_flags # appel 'base' des tags, obtention $CPU_FLAGS
@ -532,14 +532,14 @@ fi_cpu(){ # 10/11/2017
var_temp=$(grep -E "^${iflag^^}[[:blank:]]" <<< $CPU_FLAGS)
[ "$var_temp" ] && text_flags+=" ‣ $var_temp \n" || text_flags+=" ‣ $iflag\t⟷ \t? \n"
done
[ "$cpu_flags" ] && cpu_flags="$(f__wcv -w "$cpu_flags" flags) flags: $cpu_flags"
[ "$cpu_flags" ] && qte_flags=$( f__wcv -w "$cpu_flags" flags)
[ "$fg_cpu" ] || figet_cpu
###
[ ${fg_cpu:0:1} -gt 1 ] && pluriel="s" || unset pluriel
text="## processeur"$pluriel" \n\n"
f_display "fg_cpu" "cmd" "lscpu" # affichage proc
f_display "fg_uarch" "var" "µarchitecture processeur"
f_display "cpu_flags" "var" "flags cpu" # flags cpu bruts
f_display "cpu_flags" "var" "$qte_flags flags cpu" # flags cpu bruts
f_display "text_flags" "sans" # flags cpu texte
printf "$text\n" >> "$fileOutput"
unset text
@ -955,7 +955,7 @@ fi_efi(){ # 19/11/2017
unset text
}
fi_graph(){ # 13/11/2017
fi_graph(){ # 19/11/2017
local slots ig cmd cards stock_glxinfo glx_dev glx_dev_temp openGl providers resolutions
local pluriel modules text
local alert_hybrid alert_3D
@ -998,12 +998,12 @@ fi_graph(){ # 13/11/2017
# test 3D actif
glx_dev=$( grep -i 'direct rendering:' <<< "$stock_glxinfo" )$'\n'
if grep -iq 'direct rendering: No' <<< "$stock_glxinfo" ; then
alert_3D="l'accélération 3D n'est pas activée"
alert_3D="l'accélération 3D n'est pas active"
fi
# devices
glx_dev+=$( grep 'Device: ' <<< "$stock_glxinfo" | xargs )
# openGL
fi_graph_openGl(){ # $1="|opt|dri", assigne $openGl pour une ou plusieurs gpu (dri & optirun)
fi_graph_openGl(){ # $1="|opt|dri", assigne $openGl pour un ou plusieurs gpu (dri & optirun)
local iogl
[[ "$1" == "dri" || "$1" == "opt" ]] && openGl+="◽"
for iogl in 'vendor' 'renderer' 'version' 'shading language version' 'extensions'; do
@ -1022,10 +1022,11 @@ fi_graph(){ # 13/11/2017
glx_dev_temp=$( DRI_PRIME=1 glxinfo | grep 'Device: ' | xargs )
fi_graph_openGl "dri" # ajout à $openGl existant, à voir si infos sorties redondantes
fi
[ "$glx_dev_temp" != "$glx_dev" ] && glx_dev+="\n $glx_dev_temp" # ajout si diff, pas suffisant avec optirun?
[ "$glx_dev_temp" != "$glx_dev" ] && glx_dev+="\n$glx_dev_temp" # ajout si diff, pas suffisant avec optirun?
fi
openGl=${openGl/ string:/:} # suppression chaîne ' string'
openGl=${openGl::-1} # suppression dernier $'\n'
openGl=${openGl// string:/:} # suppression chaîne ' string'
openGl=${openGl::-1} # suppression dernier $'\n'
openGl=${openGl% } # suppression espace final éventuel
fi
# xrandr: résolutionS & providers & preferred/current
[ $(f__cmd_exist xrandr) ] && resolutions="$( xrandr --query | grep -A11 'Screen [0-9]' )"
@ -1333,7 +1334,7 @@ fi_packagers(){ #v2 19/11/2017
fi
}
fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
fi_pkg_apt(){ #v3 19/11/2017
local dateMaj nb_packages ifile info_update text pluriel
local sources comment_sources cmd_sources apt_v apt_version
local apt_prefs comment_apt_prefs cmd_apt_prefs
@ -1346,13 +1347,14 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
local non_ii qte_non_ii comment_non_ii cmd_non_ii etat ligne stock_etat
local deborphan qte_deborphan comment_deborphan cmd_deborphan
local holded qte_holded comment_holded cmd_holded
local httpsAlert alert_non_list alert_httpredir alert_upgrade alert_full_upgrade alert_remove
local alert_autoclean alert_clean alert_non_ii alert_deborphan
local alert_https alert_httpsPossible alert_non_list alert_httpredir alert_upgrade alert_full_upgrade
local alert_remove alert_autoclean alert_clean alert_non_ii alert_deborphan
# avertissement
info_update="apt update n'a pas été lancé. Se référer à la date de mise à jour "
info_update+="et au besoin relancer le script après avoir lancé la mise à jour. \n"
info_update+="la précision de cette partie du rapport pourra en être améliorée. \n"
info_update+="Pour info, en cas de soucis sur apt, lancer en root: \`apt-get check\`"
info_update+="et au besoin relancer le script après avoir lancé la mise à jour (si la mise "
info_update+="était trop ancienne) la précision de cette partie du rapport pourra en être "
info_update+="améliorée. \n"
info_update+="Pour info, en cas de soucis sur apt, ne pas hésiter à lancer en root: **apt-get check**"
# sources & divers
dateMaj=$( date -r /var/cache/apt/pkgcache.bin '+%d/%m/%Y %H:%M %z' 2>/dev/null) || \
dateMaj=$( date -r /var/cache/apt '+%d/%m/%Y %H:%M %z' 2>/dev/null) # /var/lib/dpkg/
@ -1377,6 +1379,11 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
alert_https="le paquet <apt-transport-https> est inutile maintenant avec la version $apt_v d'apt (depuis 1.6)"
else
unset alert_https
fi
alert_httpsPossible=$( gawk '{if ( $1 > 1.5 ) {print "https possible"}}' <<< $apt_v )
if [ "$alert_httpsPossible" ]; then
alert_httpsPossible="votre version d'apt ($apt_v) permet d'utiliser simplement les sources avec "
alert_httpsPossible+="le protocole https et les dépôts deb.debian.org"
fi
# httpredir
if grep -iq 'httpredir' <<< $sources ; then
@ -1392,6 +1399,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
stock_upgd=$( LC_ALL=C apt-get upgrade --simulate )
# $1 upgraded, $6 to remove, $10 not upgraded # => qte_upgradable [0]=upgraded, [1]=notUpgraded
qte_upgradable=($( gawk '/ newly installed/{print $1" "$10}' <<< $stock_upgd )) # tableau
{
# upgrade
[ "${qte_upgradable[0]}" -gt 1 ] && pluriel="s" || unset pluriel
comment_upgrade="${qte_upgradable[0]} paquet"$pluriel" à mettre à jour"
@ -1401,8 +1409,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
upgrade=$( grep '^Inst' <<< "$stock_upgd" | sort | gawk '{
sub(/\(/,"",$4); sub(/\/.*/,"",$5); sub(/\[/,"",$3); sub(/\]/,"",$3);
printf "%-25s source: %-25s %-20s ⇉ %-20s\n",$2,$5,$3,$4 }')
alert_upgrade="les paquets peuvent être mis à jour avec: \n"
alert_upgrade+='`apt upgrade` '
alert_upgrade="ces paquets peuvent être mis à jour avec: **apt upgrade**"
fi
# full-upgrade
if [ "${qte_upgradable[1]}" -gt 0 ]; then
@ -1413,8 +1420,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
[ "${qte_upgradable[1]}" -gt 1 ] && pluriel="s" || unset pluriel
comment_notUpgraded="${qte_upgradable[1]} paquet"$pluriel" nécessitant une mise à jour profonde)"
cmd_notUpgraded=""
alert_full_upgrade="les paquets peuvent être mis à jour avec avec: \n"
alert_full_upgrade+='`apt full-upgrade`'
alert_full_upgrade="ces paquets peuvent être mis à jour avec avec: **apt full-upgrade**"
fi
printf "◇"
# autoremove
@ -1429,8 +1435,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
if [ "$qte_toRemove" -gt 0 ]; then
toRemove=$( sed -E '/^Remv/!d; s/\[.*\]//g; s/Remv //' <<< $toRemove | tr '\n' ' ' )
toRemove=${toRemove// / }
alert_remove="les paquets peuvent être supprimés avec: \n"
alert_remove+='`apt autoremove --purge` \n\n'
alert_remove="les paquets peuvent être supprimés avec: **apt autoremove --purge** \n\n"
alert_remove+="vérifier que la liste ne contient pas des applications devenues importantes \n"
alert_remove+="au besoin, les marquer comme installées manuellement avec apt-mark manual <paquet> \n"
alert_remove+="ou les installer manuellement avec apt install <paquet>"
@ -1446,8 +1451,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
if [ "$qte_autoclean" -gt 0 ]; then
autoclean=$( gawk '{print $2}' <<< $autoclean | sort | tr '\n' ' ' )
alert_autoclean="ces archives de paquets, sans utilité directe dans le système, "
alert_autoclean+="peuvent être supprimées avec: \n"
alert_autoclean+='`apt autoclean` \n'
alert_autoclean+="peuvent être supprimées avec: **apt autoclean**"
fi
# clean
clean=$( LC_ALL=C LC_ALL=C du -chS /var/cache/apt/archives/ 2>/dev/null )
@ -1461,8 +1465,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
cmd_clean="du -chS /var/cache/apt/archives/"
if [ "$size_clean" -gt 200 ]; then # alerte si > à 100 ko (cache pas vide)
alert_clean="$qte_clean archive"$pluriel" dans le cache de téléchargement des paquets \n"
alert_clean+="$size_cleanH pourraient être libérés en effaçant ce cache: \n"
alert_clean+='`apt clean` \n'
alert_clean+="$size_cleanH pourraient être libérés en effaçant ce cache: **apt clean**"
else # cache vide (72ko à 120ko)
clean="• cache vide"
fi
@ -1502,7 +1505,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
if grep -q '^rc' <<< "$stock_etat"; then
alert_non_ii="les paquets dans un état 'rc' (fichiers de configuration orphelins) "
alert_non_ii+="peuvent être purgés avec: \n"
alert_non_ii+="\`dpkg --purge \$(dpkg -l | awk '/^rc/{print \$2}'\`)"
alert_non_ii+="**dpkg --purge \$(dpkg -l | awk '/^rc/{print \$2}')**"
fi
fi
# deborphan éventuel
@ -1515,7 +1518,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
[ "$qte_deborphan" -eq 0 ] && comment_deborphan=${comment_deborphan/0 /aucune }
if [ "$qte_deborphan" -gt 0 ]; then
alert_deborphan="bibliothèque"$pluriel" orpheline"$pluriel", suppression possible: \n"
alert_deborphan+='`apt purge \$(deborphan)` \n'
alert_deborphan+="**apt purge \$(deborphan)** \n"
alert_deborphan+="recherche légère, mais vérifier avant de valider la suppression \n"
alert_deborphan+="Relancer la commande jusqu'à vidage complet, les bibliothèques pouvant "
alert_deborphan+="s'installer en cascade"
@ -1529,6 +1532,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
comment_holded="$qte_holded paquet"$pluriel" figé"$pluriel
[ "$qte_holded" -eq 0 ] && comment_holded=${comment_holded/0 /aucun }
cmd_holded="apt-mark showhold"
}
###
text="## gestion de paquets **${1#*:}** \n\n"
text+="* nombre de paquets installés: **$nb_packages** \n"
@ -1538,6 +1542,7 @@ fi_pkg_apt(){ #v3 19/11/2017 qte comment cmd
f_dspl_alert "info_update" "info"
f_display "sources" "cmd" "$cmd_sources" "$comment_sources"
f_dspl_alert "alert_https" "info"
f_dspl_alert "alert_httpsPossible" "info"
f_dspl_alert "alert_non_list" "info"
f_dspl_alert "alert_httpredir" "info"
f_display "apt_prefs" "cmd" "$cmd_apt_prefs" "$comment_apt_prefs"
@ -1702,7 +1707,7 @@ fi_reseau(){ # 18/11/2017
f_display "cards" "cmd" "lspci -nnv | grep -EiA 15 'network|ethernet"
# ip locales avec type
[ $(f__wcv "-l" "$fg_ip_tp") -gt 1 ] && pluriel="s" || unset pluriel
f_display "fg_ip_tp" "var" "" "IP locale"$pluriel
f_display "fg_ip_tp" "sans" "" "IP locale"$pluriel
f_dspl_alert "alert_wlx" "alert"
text+="* les adresses Mac peut être affichées avec "'`./getInfo --mac` ou `getInfo --mac`'" (script installé) \n"
text+="* l'IP publique peut être connue avec: "'`./getInfo --ip` ou `getInfo --ip` (script installé) \n\n'
@ -1841,7 +1846,7 @@ fi_system_analyse(){ # 19/11/2017
unset text
}
fi_systeme(){ # 18/11/2017
fi_systeme(){ # 19/11/2017
local mbr uname bootImage initDaemon xorg shells lastboot uptime charge pluriel text
local alimentation alim_total ish ifs_origin ligne date_install microcode
local alert_SLiM alert_microcode
@ -1908,7 +1913,7 @@ fi_systeme(){ # 18/11/2017
if [[ "$debOnlyPackages" =~ $fg_vendor ]]; then
[ "$fg_vendor" == "amd" ] && microcode="amd64-microcode" || microcode="intel-microcode"
alert_microcode="microcodes $fg_vendor non installés (corrections bugs du processeur) (non libres), "
alert_microcode+="les installer: \n\`apt install $microcode\`"
alert_microcode+="les installer: **apt install $microcode**"
fi
###
f__architecture || f__info "Architecture non supportée" "vous pouvez contacter $projet, $contact " \

View File

@ -4,9 +4,11 @@
* ! f__requis, fscript_install, f__scandir
## 2.40.1 19/11/2017
## 2.40.2 19/11/2017
* nouveau: fi_pkg_apt, alert htps
* révision: affichage des commandes dans les conseils
* révision: fi_cpu, afichage du nombre de flags
* fix: fi_system_analyse, contournement, plante sous buster en root, svg non généré
## 2.39.0 19/11/2017