getInfo 2.15.0

This commit is contained in:
kyodev 2017-10-25 05:21:16 +02:00
commit fc5511c83e
2 changed files with 80 additions and 52 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.14.5
version=2.15.0
date="24/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -375,7 +375,8 @@ echo -e "$STD\n plus d'infos: $GREEN$urlNotice\n$STD"
fi_batt(){ # 22/10/2017
local pluriel
[ "$fget_batt_nb" ] || figet_batt # appel figet_battery si pas déjà fait par fi_systeme
[[ "$fget_batt_nb" == "-1" || "$fget_batt_nb" -gt 0 ]] || return 0
[[ "$fget_batt_nb" == "-1" || "$fget_batt_nb" -gt 0 ]] || return 0 # pas de batterie
###
[ "$fget_batt_nb" -gt 1 ] && pluriel="s" || unset pluriel
text="## batterie$pluriel \n\n"
f_display "fget_batt" "sans"
@ -521,33 +522,47 @@ fi_dmesg(){ # 22/10/2017
echo -e "$text" >> "$fileOutput"
}
fi_graph(){ # 23/10/2017
local slotGraphCards graphCards openGl resolutions logXorg modules text
# graphCards="$(lspci -nnk | grep -iEA 3 'vga|display|3d')"
# graphCards="$(lspci -nnv | grep -iEA 13 '^[0-9]+.*vga|display|3d')"
slotGraphCards="$(lspci | grep -iE 'vga|display|3d' | sed -En 's/^([0-9.:]+).*$/\1/gp')"
fi_graph(){ # 24/10/2017
local slotGraphCards graphCards openGl resolutions logXorg modules ig text
# graphCardsManuel="$(lspci -nnk | grep -EiA 3 'vga|display|3d')"
# graphCardsManuel="$(lspci -nnv | grep -iEA 13 'vga|display|3d)"
# graphCardsManuel="lspci -nnv -s $( lspci | grep -Ei 'vga|display|3d' | cut -d" " -f1 )"
slotGraphCards="$(lspci | grep -Ei 'vga|display|3d' | cut -d" " -f1)"
# debug: slotGraphCards="$(cat tests/lspci | grep -Ei 'vga|display|3d' | cut -d" " -f1)"
for ig in $slotGraphCards; do
graphCards+="$(lspci -s $ig -nnv)"$'\n'
graphCards+="$(lspci -nnv -s $ig)"$'\n'
done
unset ig
graphCards=${graphCards::-1} # suppression dernier $'\n'
if [ "$(f__cmd_exist optirun)" ]; then
infoBumblebee="Attention **Bumblebee** est installé. Cela peut désactiver l'affichage de \`lspci\` "
infoBumblebee+="comme par exemple: \'!!! Unknown header type 7f\'. Vous pouvez lancer alors le script "
infoBumblebee+="avec optirun ./getInfo"
fi
[ "$(f__cmd_exist glxinfo)" ] && openGl="$(glxinfo | grep 'OpenGL version')"
[ "$(f__cmd_exist xrandr)" ] && resolutions="$(xrandr --query | grep '^ *[0-9]' | head -n 10)"
modules="$(lsmod | grep -iE 'amdgpu|ati|i915|nouveau|nvidia|radeon|video|gma')"
modules="$(lsmod | grep -Ei 'amdgpu|ati|i915|nouveau|nvidia|radeon|video|gma')"
[ "$fget_resolution" ] || figet_gpu
[ "$fget_resolution" ] || figet_resolution
###
text="## graphisme \n\n"
text+="$(sed -E 's/(.*)/ \* \*\*\1\*\*/' <<<$fget_gpu) \n"
text+="\n**résolution: $fget_resolution** \n\n"
# cartes graphiques
text+="$(sed -E 's/(.*)/> \* \*\*\1\*\*/' <<< $fget_gpu) \n"
# résolution active
text+="\n\n**résolution: $fget_resolution** \n\n"
# lspci
f_display "graphCards" "cmd" "lspci -nnv | grep -iEA 13 'vga|display|3d"
# f_display "graphCards" "cmd" "lspci -nnv -s \$( lspci | grep -Ei 'vga|display|3d' | cut -d\" \" -f1 )"
# openGl
[ "$openGl" ] && f_display "openGl" "cmd" "glxinfo | grep 'OpenGL version"
# résolutions possibles, pas d'affichage si vode (ssh) ou xrandr pas accessible
if [ "$resolutions" ]; then
f_display "resolutions" "cmd" "xrandr --query | grep '^ *[0-9]' | head -n 10" "(10 premières résolutions possibles)"
fi
# modules vidéo
text+="### modules video \n\n"
if [ "$modules" ]; then
f_display "modules" "var" "liste non garantie complète"
[ "$infoBumblebee" ] && text+="$infoBumblebee"
else
text+="Modules non reconnus. Il serait bien de communiquer le retour de \`lsmod\` pour mettre "
text+="à jour le script. Merci de contacter $projet: \n$contact "
@ -555,22 +570,25 @@ fi_graph(){ # 23/10/2017
echo -e "$text" >> "$fileOutput" # flush fonction
}
fi_hw(){ # 22/10/2017
fi_hw(){ # 24/10/2017
figet_hw
###
text="## hardware monitor ACPI \n\n"
if [ "$fget_hw" ]; then
text="## hardware monitor ACPI \n\n"
f_display "fget_hw" "sans"
else
text+="**pas d'informations détectées** \n\n"
echo -e "$text" >> "$fileOutput"
fi
}
fi_journal(){ # 22/10/2017
local jctl_alert_k jctl_crit_k jctl_err_k jctl_warn_k file text nb_lignes=25
local jctl_warn_nok
fi_journal(){ # 24/10/2017
local jctl_boot jctl_alert_k jctl_crit_k jctl_err_k jctl_warn_k jctl_warn_nok file text nb_lignes=25
[ "$(f__cmd_exist journalctl)" ] || fi_dmesg # pas systemd, appel dmesg
file="/tmp/$$-$RANDOM-journalctl"
[ "$EUID" -eq 0 ] || echo
f__sudo "LC_ALL=C journalctl --no-hostname --boot 0 -k -p 1 > $file-alert ; \
f__sudo "LC_ALL=C journalctl --no-hostname --boot 0 | sed -E -n '/^-- Logs begin.*$/p' > $file-boot ; \
LC_ALL=C journalctl --no-hostname --boot 0 -k -p 1 > $file-alert ; \
LC_ALL=C journalctl --no-hostname --boot 0 -k -p 2..2 > $file-crit ; \
LC_ALL=C journalctl --no-hostname --boot 0 -p 3..3 > $file-err ; \
LC_ALL=C journalctl --no-hostname --boot 0 -p 4..4 > $file-warn ; \
@ -583,6 +601,8 @@ fi_journal(){ # 22/10/2017
echo -e "$text" >> "$fileOutput"
return 0
fi
jctl_boot=$(cat $file-boot)
jctl_boot=$(gawk -F '--|,' '{ sub(/^ /,"",$2);print $2}' <<< $(cat $file-boot))
jctl_alert_k=$(sed '/kernel:/!d' $file-alert | sed -n 1,"$nb_lignes"p) # emergency & alert
jctl_crit_k=$(sed '/kernel:/!d' $file-crit | sed -n 1,"$nb_lignes"p)
jctl_err_k=$(sed '/kernel:/!d' $file-err | sed -n 1,"$nb_lignes"p)
@ -591,14 +611,15 @@ fi_journal(){ # 22/10/2017
[ "$jctl_crit_k" ] || jctl_crit_k=" <vide>"
[ "$jctl_err_k" ] || jctl_err_k=" <vide>"
[ "$jctl_warn_k" ] || jctl_warn_k=" <vide>"
jctl_alert_nok=$(sed '/kernel:/d; s/-- No entries --/ <vide>/' $file-alert | sed -n 1,"$nb_lignes"p)
jctl_crit_nok=$(sed '/kernel:/d; s/-- No entries --/ <vide>/' $file-crit | sed -n 1,"$nb_lignes"p)
jctl_err_nok=$(sed '/kernel:/d; s/-- No entries --/ <vide>/' $file-err | sed -n 1,"$nb_lignes"p)
jctl_warn_nok=$(sed '/kernel:/d; s/-- No entries --/ <vide>/' $file-warn | sed -n 1,"$nb_lignes"p)
jctl_alert_nok=$(sed '/-- Logs begin/d;/kernel:/d; s/-- No entries --/ <vide>/' $file-alert | sed -n 1,"$nb_lignes"p)
jctl_crit_nok=$(sed '/-- Logs begin/d;/kernel:/d; s/-- No entries --/ <vide>/' $file-crit | sed -n 1,"$nb_lignes"p)
jctl_err_nok=$(sed '/-- Logs begin/d;/kernel:/d; s/-- No entries --/ <vide>/' $file-err | sed -n 1,"$nb_lignes"p)
jctl_warn_nok=$(sed '/-- Logs begin/d;/kernel:/d; s/-- No entries --/ <vide>/' $file-warn | sed -n 1,"$nb_lignes"p)
rm "$file-"*
###
# kernel
text="## journalctl kernel (emergency, alert, erreur, warning ou critique) \n\n"
text+="**$jctl_boot** \n\n"
f_display "jctl_alert_k" "cmd" "journalctl --no-hostname --boot 0 -k -p 1" \
"(kernel emergency 0 & alerte 1, $nb_lignes premières lignes)"
f_display "jctl_crit_k" "cmd" "journalctl --no-hostname --boot 0 -k -p 2..2" \
@ -609,13 +630,14 @@ fi_journal(){ # 22/10/2017
"(kernel warning, $nb_lignes premières lignes)"
# non kernel
text+="## journalctl hors kernel (emergency, alert, erreur, warning ou critique) \n\n"
f_display "jctl_alert_nok" "cmd" "journalctl --no-hostname --boot 0 -p 1 | grep -v kernel:" \
text+="**$jctl_boot** \n\n"
f_display "jctl_alert_nok" "cmd" "journalctl --no-hostname --boot 0 -p 1 | grep -v kernel" \
"(hors kernel, emergency 0 & alerte 1, $nb_lignes premières lignes)"
f_display "jctl_crit_nok" "cmd" "journalctl --no-hostname --boot 0 -p 2..2 | grep -v kernel:" \
f_display "jctl_crit_nok" "cmd" "journalctl --no-hostname --boot 0 -p 2..2 | grep -v kernel" \
"(hors kernel, critique, $nb_lignes premières lignes)"
f_display "jctl_err_nok" "cmd" "journalctl --no-hostname --boot 0 -p 3..3 | grep -v kernel:" \
f_display "jctl_err_nok" "cmd" "journalctl --no-hostname --boot 0 -p 3..3 | grep -v kernel" \
"(hors kernel, erreur, $nb_lignes premières lignes)"
f_display "jctl_warn_nok" "cmd" "journalctl --no-hostname --boot 0 -p 4..4 | grep -v kernel:" \
f_display "jctl_warn_nok" "cmd" "journalctl --no-hostname --boot 0 -p 4..4 | grep -v kernel" \
"(hors kernel, warning, $nb_lignes premières lignes)"
text+="**les $nb_lignes premières lignes commencent à la date du dernier boot** \n\n"
echo -e "$text" >> "$fileOutput"
@ -649,7 +671,7 @@ et/ou installer le démon Ntp: apt install ntp \n"
f_display "keyboard" "cmd" "grep -Ev '#|^$' /etc/default/keyboard"
}
fi_log_xorg(){ # 22/10/2017
fi_log_xorg(){ # 24/10/2017
[ "$ENV_SSH" ] && return 0
local logXorg xfile extract text nb_lignes=50
# Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice,
@ -661,7 +683,7 @@ fi_log_xorg(){ # 22/10/2017
extract="$(grep -Es '\(WW\)|\(EE\)|\(\?\?\)' $xfile | sed '/(WW) warning, (EE) error,/d')"
extract="$(sed -n 1,"$nb_lignes"p <<< $extract)"
if [ "$extract" ]; then
logXorg+="$xfile (WW) **warning**, (EE) **erreur**, (??) inconnu, $nb_lignes premières lignes maxi \n\n"
logXorg+="$xfile (WW) **warning**, (EE) **erreur**, (??) inconnu, $nb_lignes premières lignes \n\n"
logXorg+="$(grep -E '\(EE\)' <<< $extract) \n"
logXorg+="$(grep -E '\(WW\)' <<< $extract) \n\n"
else
@ -679,21 +701,21 @@ fi_log_xorg(){ # 22/10/2017
"(Xorg.log)"
}
fi_mem(){ # 21/10/2017
local swappiness text tempo
fi_mem(){ # 24/10/2017
local swappiness text var_temp
swappiness="$(cat /proc/sys/vm/swappiness 2>/dev/null)"
figet_mem "mem" #options possibles mem swap total notitle nocoltitle
tempo="$fget_mem \n\n"
var_temp="$fget_mem \n\n"
figet_mem "swap" "notitle"
tempo+="$fget_mem \n\n"
tempo+="swappiness: $swappiness"
var_temp+="$fget_mem \n\n"
var_temp+="swappiness: $swappiness"
###
text="## mémoire \n\n"
f_display "tempo" "sans"
f_display "var_temp" "sans"
}
fi_nm(){ # 22/10/2017
[ "$(f__cmd_exist nmcli)" ] || return 0 # nécessite root sur autre que debian?
[ "$(f__cmd_exist nmcli)" ] || return 0
local nm_etat nm_conf text
nm_etat="$(grep -Ev '#|^$' /var/lib/NetworkManager/NetworkManager.state)"
nm_conf="$(grep -Ev '#|^$' /etc/NetworkManager/NetworkManager.conf)"
@ -730,11 +752,12 @@ fi_nonFree(){ # 22/09/2017
f_display "vrms" "cmd" "vrms"
}
fi_reseau(){ # 22/10/2017
fi_reseau(){ # 24/10/2017
local slotNetCard netCard ip_a iwconfig interfaces route resolv liste_canaux_wifi ifx text pluriel
# netCard="$(lspci -nnk | grep -iEA 5 'network|ethernet')"
# netCard="$(lspci -nnv | grep -iEA 15 'network|ethernet')"
slotNetCard="$(lspci | grep -iE 'network|ethernet' | sed -En 's/^([0-9.:]+).*$/\1/gp')"
# netCardManuel="$(lspci -nnk | grep -EiA 5 'network|ethernet')"
# netCardManuel="$(lspci -nnv | grep -EiA 15 'network|ethernet')"
# netCardManuel="lspci -nnv -s $( lspci | grep -Ei 'network|ethernet' | cut -d" " -f1 )"
slotNetCard="$(lspci | grep -Ei 'network|ethernet' | sed -En 's/^([0-9.:]+).*$/\1/gp')"
for ifx in $slotNetCard; do
netCard+="$(lspci -s $ifx -nnv)"$'\n'
done
@ -764,7 +787,7 @@ fi_reseau(){ # 22/10/2017
figet_mod_net
###
text="## réseau \n\n"
f_display "netCard" "cmd" "lspci -nnv | grep -iEA 15 'network|ethernet"
f_display "netCard" "cmd" "lspci -nnv | grep -EiA 15 'network|ethernet"
f_display "ip_local_type" "var" "IP locale(s):"
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'
@ -806,18 +829,17 @@ fi_reseau(){ # 22/10/2017
if [ "$fget_mod_net" ]; then
f_display "fget_mod_net" "var" "liste non garantie complète"
else
text+="Modules non reconnus. Il serait bien de communiquer le retour de \`lsmod\` pour mettre "
text+="à jour le script. Merci de contacter $projet: \n$contact "
text+="**Modules chargés non reconnus**"
fi
echo -e "$text" >> "$fileOutput" # flush fonction
}
fi_sources(){ # 22/10/2017
fi_sources(){ # 24/10/2017
[ "$(f__cmd_exist dpkg)" ] || return 0
local sources dateMaj nb_packages apt text pluriel
local alert_autoremove alert_nbAutoremove alert_paquetToRemove alert_httpredir alert_httpredir_text
local alert_upgradable alert_upgradable_text alert_nbUpgradable
local alert_alert_paquetBiz alert_paquetBiz_text0 alert_paquetBiz_text
local alert_paquetBiz alert_paquetBiz_text0 alert_paquetBiz_text
printf "."
sources="$(grep -Evrs '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list)"
sources="$(sed 's/:deb/: deb/; s/ / /g' <<< $sources)"
@ -881,6 +903,7 @@ fi_sources(){ # 22/10/2017
f_display "alert_paquetBiz" "var" "$alert_paquetBiz_text0"
text+="$alert_paquetBiz_text"' \n\n'
fi
echo -e "$text" >> "$fileOutput" # flush fonction
}
fi_ssid(){ # 22/10/2017
@ -1257,7 +1280,6 @@ figet_distro(){ # thanks neofetch, assigne $fget_distro # 09/10/2017
fget_distro="$distro"
}
# informations DMI, assigne $fget_dmi
figet_dmi(){ # 23/10/2017
# lors révision tester $(grep -s . /sys/class/dmi/id/*)
@ -1297,6 +1319,7 @@ figet_dmi(){ # 23/10/2017
figet_gpu(){ # thanks neofetch, assigne $fget_gpu # 09/10/2017
local gpu="$(lspci -mm | gawk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')"
# debug: gpu="$(cat tests/lspci | gawk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')"
case "$gpu" in
*"advanced"*)
gpu="${gpu//Intel*$'\n'}"
@ -1320,7 +1343,7 @@ figet_gpu(){ # thanks neofetch, assigne $fget_gpu # 09/10/2017
}
# infos température et fan via acpi, assigne $fget_hw
figet_hw(){ #v2 22/10/2017
figet_hw(){ #v2 14/10/2017
local name labelF inputF labelT inputT critT hystT maxiT fan temp ihw
if [ ! -d /sys/class/hwmon/ ]; then
fget_hw="gestion acpi hwmon non accessible"
@ -1378,7 +1401,7 @@ figet_hw(){ #v2 22/10/2017
fi
done
fget_hw="$temp$fan"
fget_hw=${fget_hw::-1}
[ "$fget_hw" ] && fget_hw=${fget_hw::-1}
}
# assigne $ip_local, $gateways, $gateways_type, $gateway, $gateway_type, $if_prioritaire
@ -2041,7 +2064,8 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_systeme
fi_sources
fi_reseau
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -9,17 +9,21 @@
* refaire/revoir figet_resolution
* revoir modules réseau
* bug figet_wm wayland à confirmer?
* bug quand aucun retour hwmon si bug acpi sondes (fget_hw=${fget_hw::-1})
* plus d'explications dans état paquet (rc par exemple)??
---
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
* f__cmd_exist f__sudo f__requis
## 2.14.5 24/10/2017
## 2.15.0 24/10/2017
* nouveau: début support Bumblebee
* révision: carteS dans fi_graph
* révision: fi_journal, affichage début des logs en titre, suppression dans les logs affichés
* fix: bug formatage bash quand aucun retour hwmon si bug acpi sondes
* fix: affichage d'explications état paquet dans fi_sources
* fix: affichage modules non reconnus fi_reseau
*
## 2.14.2 23/10/2017