mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.11.1
This commit is contained in:
parent
790cd190b3
commit
d2484c0df1
236
scripts/getInfo
236
scripts/getInfo
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=2.11.0
|
||||
version=2.11.1
|
||||
date="20/10/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
|
@ -1187,26 +1187,6 @@ figet_batt(){ #v2 17/10/2017
|
|||
fget_batt_nb="$batt_nb"
|
||||
}
|
||||
|
||||
figet_batt_test(){ # 17/10/2017
|
||||
local text
|
||||
if [ ! -d "/sys/class/power_supply/" ]; then
|
||||
text="répertoire /sys/class/power_supply/ inexistant"
|
||||
return 1
|
||||
fi
|
||||
text="## batterie test \n\n"
|
||||
text="\`/sys/class/power_supply/ 1\` \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput" # flush avant scandir
|
||||
f__scandir "/sys/class/power_supply/" 1
|
||||
text='``` \n' >> "$fileOutput"
|
||||
figet_batt
|
||||
text+="figet_batt \n"
|
||||
text+='```\n'
|
||||
text+="$fget_batt \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
figet_cpu(){ # thanks neofetch, assigne $fget_cpu $fget_core # 17/10/2017
|
||||
local cpu speed_dir temp_dir speedMin speed speedMin speed temp cores thread plurielc plurielt
|
||||
cpu="$(gawk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)"
|
||||
|
@ -1408,22 +1388,6 @@ figet_dmi(){ # 12/10/2017
|
|||
# done
|
||||
}
|
||||
|
||||
figet_dmi_test(){ # 17/10/2017
|
||||
local text
|
||||
text="## dmi test \n\n"
|
||||
text="\`/sys/class/dmi/ 1\` \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush avant scandir
|
||||
f__scandir "/sys/class/dmi/" 1
|
||||
text='``` \n' >> "$fileOutput"
|
||||
figet_dmi
|
||||
text+="figet_dmi \n"
|
||||
text+='``` \n'
|
||||
text+="$fget_dmi \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
figet_gpu(){ # thanks neofetch, assigne $fget_gpu # 09/10/2017
|
||||
local gpu="$(lspci -mm | gawk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')"
|
||||
case "$gpu" in
|
||||
|
@ -1458,10 +1422,11 @@ figet_hw(){ #v2 20/10/2017
|
|||
unset fan temp
|
||||
for ihw in $(ls /sys/class/hwmon/); do
|
||||
[ -e /sys/class/hwmon/$ihw/name ] && name="$(cat /sys/class/hwmon/$ihw/name)" || name="indéfini"
|
||||
## TEMPÉRATURE
|
||||
## TEMPÉRATURE
|
||||
if grep -Eq 'temp[0-9]+' <<< $(ls /sys/class/hwmon/$ihw/) ; then
|
||||
# extraction label
|
||||
labelT=$(printf "%s/" "$(cat /sys/class/hwmon/$ihw/temp*_label 2>/dev/null)")
|
||||
# labelT=$(printf "%s/" "$(cat /sys/class/hwmon/$ihw/temp*_label 2>/dev/null)" | sed 's/ //g' | tr '\n' ' ')
|
||||
labelT=$(printf "%s/" "$(cat /sys/class/hwmon/$ihw/temp*_label 2>/dev/null)" | tr ' ' '.' | tr '\n' ' ')
|
||||
# extraction températures
|
||||
inputT=$(gawk '$0!="" && $0!=0 {printf "%.1f/", $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_input 2>/dev/null))
|
||||
critT=$(gawk '$0!="" && $0!=0 {printf "%.1f/", $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_crit 2>/dev/null))
|
||||
|
@ -1476,8 +1441,8 @@ figet_hw(){ #v2 20/10/2017
|
|||
[ ${hystT:0:1} == "/" ] && hystT=${hystT:1}
|
||||
[ ${maxiT:0:1} == "/" ] && maxiT=${maxiT:1}
|
||||
# suppression dernier caractère (/) fin (nécessaire si multi-valeurs)
|
||||
[ "$labelT" ] && labelT=${labelT::-1}
|
||||
[ "$inputT" ] && inputT=${inputT::-1}
|
||||
[ "$labelT" ] && labelT=${labelT::-1}
|
||||
[ "$critT" ] && critT=${critT::-1}
|
||||
[ "$hystT" ] && hystT=${hystT::-1}
|
||||
[ "$maxiT" ] && maxiT=${maxiT::-1}
|
||||
|
@ -1488,7 +1453,7 @@ figet_hw(){ #v2 20/10/2017
|
|||
[ "$maxiT" ] && temp+="(maxi: $maxiT""°C) "
|
||||
[ "$temp" ] && temp+=$' \n'
|
||||
fi
|
||||
## FAN
|
||||
## FAN
|
||||
if grep -Eq 'fan[0-9]+' <<< $(ls /sys/class/hwmon/$ihw/) ; then
|
||||
# extraction label
|
||||
labelF=$(printf "%s/" $(cat /sys/class/hwmon/$ihw/fan*_label 2>/dev/null))
|
||||
|
@ -1504,78 +1469,6 @@ figet_hw(){ #v2 20/10/2017
|
|||
fget_hw="$temp$fan"
|
||||
}
|
||||
|
||||
figet_hw_test(){ # 20/10/2017
|
||||
local text hw_test_temp hw_test_rep
|
||||
text+="## hwmon test \n\n"
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
|
||||
# sensors et acpi éventuel
|
||||
unset text
|
||||
if [ "$(which sensors)" ]; then
|
||||
text+="\`sensors -u\` \n"
|
||||
text+='``` \n'
|
||||
text+="$(sensors -u) \n"
|
||||
text+='``` \n'
|
||||
fi
|
||||
if [ "$(which acpi)" ]; then
|
||||
text+="\`acpi -V\` \n"
|
||||
text+='``` \n'
|
||||
text+="$(acpi -V) \n"
|
||||
text+='``` \n'
|
||||
fi
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
|
||||
hw_test_function(){
|
||||
local text
|
||||
text="\`$1 $2\` \n"
|
||||
text+='``` '
|
||||
echo -e "$text" >> "$fileOutput" # flush avant scandir
|
||||
unset text
|
||||
if [ -d "$1" ]; then
|
||||
f__scandir $1 $2
|
||||
else
|
||||
text="$1 inexistant"
|
||||
fi
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
# /sys/class/hwmon/
|
||||
hw_test_rep="/sys/class/hwmon/"
|
||||
hw_test_function "$hw_test_rep" 1
|
||||
|
||||
# /sys/class/thermal/thermal_zone0/
|
||||
hw_test_rep="/sys/class/thermal/thermal_zone0/"
|
||||
hw_test_function "$hw_test_rep" 0
|
||||
|
||||
# /sys/devices/platform/coretemp.0/hwmon/
|
||||
hw_test_rep="/sys/devices/platform/coretemp.0/hwmon/"
|
||||
hw_test_function "$hw_test_rep" 1
|
||||
|
||||
# fonction script
|
||||
figet_hw
|
||||
text="figet_hw \n"
|
||||
text+='```\n'
|
||||
text+="$fget_hw \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
|
||||
# analyse méthode figet_cpu
|
||||
unset hw_test_temp
|
||||
if [ -f "/sys/class/hwmon/hwmon0/temp1_input" ]; then
|
||||
hw_test_temp="$(< "/sys/class/hwmon/hwmon0/temp1_input")"
|
||||
hw_test_temp="$((hw_test_temp * 100 / 10000))" # 33000 x 100 / 10 000 = 330
|
||||
hw_test_temp="[${hw_test_temp/${hw_test_temp: -1}}.${hw_test_temp: -1}°C]" # formatage 1 point décimal
|
||||
else
|
||||
hw_test_temp=" non accessible"
|
||||
fi
|
||||
text="hwmon0/temp1_input ala neofetch \n"
|
||||
text+='``` \n'
|
||||
text+="$hw_test_temp \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
# assigne $ip_local, $gateways, $gateways_type, $gateway, $gateway_type, $if_prioritaire
|
||||
# $ip_local, $ip_local_type, $ifnames, $ifnames_type, $mac_address, mac_address_type
|
||||
figet_ip(){ # 16/10/2017
|
||||
|
@ -1800,6 +1693,111 @@ figet_shell(){ # thanks neofetch, assigne $fget_shell # 04/10/2017
|
|||
fget_shell="$shell"
|
||||
}
|
||||
|
||||
figet_test__function(){ # 20/10/2017
|
||||
local text
|
||||
text="\`$1 $2\` \n"
|
||||
text+='``` '
|
||||
echo -e "$text" >> "$fileOutput" # flush avant scandir
|
||||
unset text
|
||||
if [ -d "$1" ]; then
|
||||
f__scandir $1 $2
|
||||
else
|
||||
text="$1 inexistant \n"
|
||||
fi
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
figet_test_batt(){ # 20/10/2017
|
||||
local text figet_test_rep
|
||||
text="## batterie test \n\n"
|
||||
# acpi éventuel
|
||||
if [ "$(which acpi)" ]; then
|
||||
text+="\`acpi -abi\` \n"
|
||||
text+='``` \n'
|
||||
text+="$(acpi -abi) \n"
|
||||
text+='``` \n'
|
||||
fi
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
# /sys/class/power_supply/
|
||||
figet_test_rep="/sys/class/power_supply/"
|
||||
figet_test__function "$figet_test_rep" 1
|
||||
# fonction script
|
||||
figet_batt
|
||||
text="figet_batt \n"
|
||||
text+='```\n'
|
||||
text+="$fget_batt \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
figet_test_dmi(){ # 20/10/2017
|
||||
local text figet_test_rep
|
||||
text="## dmi test \n\n"
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
# /sys/class/dmi/
|
||||
figet_test_rep="/sys/class/dmi/"
|
||||
figet_test__function "$figet_test_rep" 1
|
||||
# fonction script
|
||||
figet_dmi
|
||||
text+="figet_dmi \n"
|
||||
text+='``` \n'
|
||||
text+="$fget_dmi \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
figet_test_hw(){ # 20/10/2017
|
||||
local text hw_test_temp figet_test_rep
|
||||
text+="## hwmon test \n\n"
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
# sensors et acpi éventuel
|
||||
unset text
|
||||
if [ "$(which sensors)" ]; then
|
||||
text+="\`sensors -u\` \n"
|
||||
text+='``` \n'
|
||||
text+="$(sensors -u) \n"
|
||||
text+='``` \n'
|
||||
fi
|
||||
if [ "$(which acpi)" ]; then
|
||||
text+="\`acpi -V\` \n"
|
||||
text+='``` \n'
|
||||
text+="$(acpi -V) \n"
|
||||
text+='``` \n'
|
||||
fi
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
# /sys/class/hwmon/
|
||||
figet_test_rep="/sys/class/hwmon/"
|
||||
figet_test__function "$figet_test_rep" 1
|
||||
# /sys/class/thermal/thermal_zone0/
|
||||
figet_test_rep="/sys/class/thermal/thermal_zone0/"
|
||||
figet_test__function "$figet_test_rep" 0
|
||||
# /sys/devices/platform/coretemp.0/hwmon/
|
||||
figet_test_rep="/sys/devices/platform/coretemp.0/hwmon/"
|
||||
figet_test__function "$figet_test_rep" 1
|
||||
# fonction script
|
||||
figet_hw
|
||||
text="figet_hw \n"
|
||||
text+='```\n'
|
||||
text+="$fget_hw \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
# analyse méthode neofetch
|
||||
unset hw_test_temp
|
||||
if [ -f "/sys/class/hwmon/hwmon0/temp1_input" ]; then
|
||||
hw_test_temp="$(< "/sys/class/hwmon/hwmon0/temp1_input")"
|
||||
hw_test_temp="$((hw_test_temp * 100 / 10000))" # 33000 x 100 / 10 000 = 330
|
||||
hw_test_temp="[${hw_test_temp/${hw_test_temp: -1}}.${hw_test_temp: -1}°C]" # formatage 1 point décimal
|
||||
else
|
||||
hw_test_temp=" non accessible"
|
||||
fi
|
||||
text="hwmon0/temp1_input ala neofetch \n"
|
||||
text+='``` \n'
|
||||
text+="$hw_test_temp \n"
|
||||
text+='``` \n'
|
||||
echo -e "$text" >> "$fileOutput" # flush
|
||||
}
|
||||
|
||||
figet_wm(){ # thanks neofetch, assigne $fget_wm # 09/10/2017
|
||||
local id wm
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
|
@ -2156,24 +2154,24 @@ for j in $options; do
|
|||
exit ;; # affichage help
|
||||
--debug-all )
|
||||
prg_1 "$*"
|
||||
figet_batt_test
|
||||
figet_dmi_test
|
||||
figet_hw_test
|
||||
figet_test_batt
|
||||
figet_test_dmi
|
||||
figet_test_hw
|
||||
prg_3
|
||||
exit ;; # test batterie, dmi, hwmon
|
||||
--debug-batt )
|
||||
prg_1 "$*"
|
||||
figet_batt_test
|
||||
figet_test_batt
|
||||
prg_3
|
||||
exit ;; # test batterie avec scan /sys/class/power_supply/
|
||||
--debug-dmi )
|
||||
prg_1 "$*"
|
||||
figet_dmi_test
|
||||
figet_test_dmi
|
||||
prg_3
|
||||
exit ;; # test dmi avec affichage /sys/class/dmi/id/
|
||||
--debug-hw )
|
||||
prg_1 "$*"
|
||||
figet_hw_test
|
||||
figet_test_hw
|
||||
prg_3
|
||||
exit ;; # test hwmon avec affichage /sys/class/hwmon/
|
||||
--ip )
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
|
||||
|
||||
## 2.11.0 20/10/2017
|
||||
## 2.11.1 20/10/2017
|
||||
|
||||
* révision: figet_hw v2, name, label et filtrage 0°C
|
||||
* révision: figet_hw_test
|
||||
* révision: figet_hw_test, figet_test_batt, figet_test_dmi
|
||||
|
||||
## 2.10.3 19/10/2017
|
||||
|
||||
|
|
Loading…
Reference in New Issue