getInfo 2.14.1

This commit is contained in:
kyodev 2017-10-23 09:30:57 +02:00
parent ffd7197150
commit 3d2e0a58df
2 changed files with 51 additions and 30 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
version=2.14.0
date="22/10/2017"
version=2.14.1
date="23/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo"
@ -521,7 +521,7 @@ fi_dmesg(){ # 22/10/2017
echo -e "$text" >> "$fileOutput"
}
fi_graph(){ # 22/10/2017
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')"
@ -538,10 +538,8 @@ fi_graph(){ # 22/10/2017
[ "$fget_resolution" ] || figet_resolution
###
text="## graphisme \n\n"
text+="| | | \n"
text+="| --- | --- | \n"
text+="| GPU | **$fget_gpu** | \n\n"
text+="**résolution: $fget_resolution** \n\n"
text+="$(sed -E 's/(.*)/ \* \*\*\1\*\*/' <<<$fget_gpu) \n"
text+="\n**résolution: $fget_resolution** \n\n"
f_display "graphCards" "cmd" "lspci -nnv | grep -iEA 13 'vga|display|3d"
[ "$openGl" ] && f_display "openGl" "cmd" "glxinfo | grep 'OpenGL version"
if [ "$resolutions" ]; then
@ -920,9 +918,10 @@ fi_system_analyse(){ # 22/10/2017
f_display "bootBlame" "cmd" "systemd-analyze blame | head -n 20"
}
fi_systeme(){ # 22/10/2017
fi_systeme(){ # 23/10/2017
local mbr description uname bootImage initDaemon xorg shells lastboot uptime charge pluriel text
[ -d /sys/firmware/efi ] && mbr="**EFI**" || mbr="**Legacy (mbr)**"
local alim_total alimentation
[ -d /sys/firmware/efi ] && mbr="EFI" || mbr="Legacy (mbr)"
[ -x "/usr/bin/lsb_release" ] && description="$(lsb_release -ds)" #dépend de apt install lsb-release, sur debian, en standard, juste : lsb-base
uname="$(uname -rmo)"
bootImage="$(gawk '/BOOT_IMAGE/ {print $1}' /proc/cmdline)"
@ -933,6 +932,16 @@ fi_systeme(){ # 22/10/2017
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && xorg="wayland" || xorg="indéterminé"
fi
shells="$(grep -Ev '^[[:blank:]]*#|^$' /etc/shells | sed 's/\/bin\///' | tr '\n' ' ')"
if [ -d /sys/class/power_supply/AC* ]; then
alim_total=$(grep -cs . <<< $(ls /sys/class/power_supply/AC*/online))
# alim_on=$(grep -cs '1' /sys/class/power_supply/AC*/online)
# alim_off=$(grep -cs '0' /sys/class/power_supply/AC*/online)
alimentation=$( awk -v "alim_total=$alim_total" '
{ alim_on=sprintf("%d", $1); if (alim_on>1) pllo="s" }
END { if ( alim_total > 1 ) pllt="s"; printf alim_total " alimentation" pllt
if ( alim_total != alim_on ) print ", " alim_on " branchée" pllo; else print "" }
' /sys/class/power_supply/AC*/online )
fi
# lastboot="$(last -n 1 --time-format iso reboot | gawk 'FNR==1 {sub(/T/," ",$5);print $5}')" # remis à jours en début de mois ?!!
lastboot="$(date -r /var/run/utmp '+%d/%m/%Y %H:%M %z')"
uptime="$(uptime -p | sed 's/up/depuis/; s/week/semaine/; s/weeks/semaines/; s/days/jours/; s/day/jour/; s/hour[s]*/h/; s/minute[s]*/mn/')"
@ -948,16 +957,16 @@ fi_systeme(){ # 22/10/2017
figet_shell
figet_wm
###
text="## système \n\n"
text+="$fget_dmi \n\n"
text+="| | | \n"
text+="| --- | --- | \n"
text+="| CPU | **$(sed -n '1p' <<< $fget_cpu)** | \n"
text+="| GPU | **$fget_gpu** | \n"
text+="| boot | $mbr | \n\n"
text+="distribution | **$fget_distro** \n"
f__architecture || f__info "Architecture non supportée" "vous pouvez contacter $projet, $contact " \
"pour aider à parfaire le script"
text="## système \n\n"
text+="$fget_dmi \n\n"
text+="* CPU \n"
text+=" * **$(sed -n '1p' <<< $fget_cpu)** \n"
text+="* GPU \n"
text+="$(sed -E 's/(.*)/ \* \*\*\1\*\*/' <<<$fget_gpu) \n"
text+="* boot **$mbr** \n"
text+="* distribution **$fget_distro** \n\n"
text+='``` \n'
text+="architecture: $architecture \n"
[ "$description" ] && text+="description: $description \n"
@ -971,6 +980,7 @@ fi_systeme(){ # 22/10/2017
text+="shell actif: $fget_shell \n"
text+="shells installés: $shells \n"
text+="$fget_disk_part_fix_tot \n"
[ "$alimentation" ] && text+="$alimentation \n"
if [ "$fget_batt" ]; then
[ "$fget_batt_nb" -gt "1" ] && pluriel="s" || unset pluriel
text+="$fget_batt_nb batterie$pluriel présente$pluriel: \n"
@ -1105,14 +1115,14 @@ figet_cpu(){ #v2 22/10/2017
/siblings/ { procThread=sprintf("%d",$2); if (procThread>1) pllt="s" }
/microcode/ { sub(/^ /,"",$2); microCode=$2 }
END { print nbCpu" x "cpu " (" procCore "core" pllc "," procThread "thread" pllt ") {" speedCpu "} microcode:" microCode }
' <<< "$cpuinfo "
' <<< "$cpuinfo "
)
cpu2=$(
gawk -F ':' '
/^vendor_id/{gsub(/ /,"",$2);vendor=$2}; /^cpu family/{family=$2};
/^model[^ ]/{model=$2}; /^stepping/{rev=$2}
END {print vendor" famille" family", modèle"model", révision" rev}
' <<< "$cpuinfo"
' <<< "$cpuinfo"
)
cpu3=$(
gawk -F ':' '
@ -1121,7 +1131,7 @@ figet_cpu(){ #v2 22/10/2017
/cache size/ {gsub(/ /,"",$2); gsub(/B/,"o",$2); gsub(/K/,"k",$2); cache=$2}
/bogomips/ { bogomips=sprintf("%d",$2) }
END { print add ", bogomips: " bogomips ", cache: " cache }
' <<< "$cpuinfo"
' <<< "$cpuinfo"
)
fget_cpu=$(echo -e "$cpu1\n$cpu2\n$cpu3")
}
@ -1598,13 +1608,14 @@ figet_shell(){ # thanks neofetch, assigne $fget_shell # 04/10/2017
fget_shell="$shell"
}
figet_test_batt(){ # 22/10/2017
local text var_temp
figet_test_batt(){ # 23/10/2017
local text var_temp objet
# matériel
figet_dmi
figet_batt
###
f_display "fget_dmi" "sans"
text="--- \n\n"
###
text+="## batterie test \n\n"
# acpi éventuel
if [ "$(f__cmd_exist acpi)" ]; then
@ -1612,11 +1623,15 @@ figet_test_batt(){ # 22/10/2017
[ "$var_temp" ] || var_temp="pas de batterie dans $(f__cmd_exist acpi)"
f_display "var_temp" "cmd" "acpi -abi"
fi
# /sys/class/power_supply/
var_temp="/sys/class/power_supply/"
f_display_scandir "$var_temp" 1
# upower
if [ "$(f__cmd_exist upower)" ]; then
objet=$(grep -i 'battery' <<< $(upower -e))
var_temp=$(upower -i $objet)
f_display "var_temp" "cmd" "upower -i $objet"
fi
# scandir
[ -d /sys/class/power_supply/BAT* ] && f_display_scandir "/sys/class/power_supply/" 1
# fonction script
figet_batt
f_display "fget_batt" "var" "figet_batt"
}
@ -1991,7 +2006,7 @@ if [[ "$options" =~ all|-d|-h|-c ]]; then
urlNotice="https://kyodev.frama.io/kyopages/scripts/getInfo/"
fi
fi
ligneRapport="Rapport du $(date '+%d/%m/%Y %H:%M %z') - $0 $* - [$script $version]($urlNotice)"
ligneRapport="Rapport du $(date '+%d/%m/%Y %H:%M %z') | $0 $* | [$script $version]($urlNotice)"
for k in $options; do
categorie+="$(sed -En 's/-c([a-z]+)/\1/p' <<< $k)"
@ -2005,7 +2020,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_hw
fi_graph
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -7,14 +7,20 @@
* réseau réviser, interface name: virbr0
* "alertifier" fi-reseau
* refaire/revoir figet_resolution
* bug tableau gpu si 2 cartes graphiques
* revoir modules réseau
* bug figet_wm wayland à confirmer?
---
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
* f__cmd_exist f__sudo f__requis
## 2.14.1 23/10/2017
* nouveau: nb alims total/branchée
* révision: figet_test_batt (upower)
* fix: fi_systeme, fi_graph: bug affichage gpu si 2 cartes graphiques
## 2.14.0 22/10/2017
* nouveau: détection connexion shh