mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.4.0
This commit is contained in:
parent
c59b917cd2
commit
1892e0602a
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=2.3.0
|
||||
date="12/10/2017"
|
||||
version=2.4.0
|
||||
date="13/10/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
script="getInfo"
|
||||
|
@ -718,7 +718,7 @@ fi_reseau(){ # 12/10/2017
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_sources(){ # 12/10/2017
|
||||
fi_sources(){ # 13/10/2017
|
||||
[ "$(which dpkg)" ] || return 0
|
||||
local sources dateMaj nb_packages apt text pluriel
|
||||
local alert_autoremove alert_nbAutoremove alert_paquetToRemove alert_httpredir alert_httpredir_text
|
||||
|
@ -755,13 +755,13 @@ fi_sources(){ # 12/10/2017
|
|||
if [ "$alert_paquetBiz" ]; then
|
||||
[ "$(grep -c '.' <<< "$alert_paquetBiz")" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
alert_paquetBiz_text0="$(grep -c '.' <<< "**$alert_paquetBiz") paquet$pluriel dans un état non installé**"
|
||||
[[ ${alert_paquetBiz,,} =~ ^. ]] && alert_paquetBiz_text="* **Ètat souhaité** "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^. ]] && alert_paquetBiz_text="* **État souhaité** "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^h ]] && alert_paquetBiz_text+=" * **h**old (à garder) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^i ]] && alert_paquetBiz_text+=" * **i**nstall (à installer) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^p ]] && alert_paquetBiz_text+=" * **p**urge (à purger) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^r ]] && alert_paquetBiz_text+=" * **r**emove (à supprimer) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^u ]] && alert_paquetBiz_text+=" * **u**nknown (inconnu) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^.. ]] && alert_paquetBiz_text+="* **Ètat du paquet** "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^.. ]] && alert_paquetBiz_text+="* **État du paquet** "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^.c ]] && alert_paquetBiz_text+=" * **c**onfig-files (fichiers de configuration seuls) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^.f ]] && alert_paquetBiz_text+=" * hal**F**-configured-configured (semi-configuré) "$'\n'
|
||||
[[ ${alert_paquetBiz,,} =~ ^.h ]] && alert_paquetBiz_text+=" * **H**alf-installed (semi-installé) "$'\n'
|
||||
|
@ -1203,7 +1203,7 @@ figet_dmi(){ # 12/10/2017
|
|||
# done
|
||||
}
|
||||
|
||||
figet_dmi_test(){ # 12/10/2017
|
||||
figet_dmi_test(){ # 13/10/2017
|
||||
#manuel: for i in $(ls /sys/class/dmi/id/); do printf "$i: "; cat /sys/class/dmi/id/$i; done
|
||||
local idmi text
|
||||
text="## dmi test \n\n"
|
||||
|
@ -1217,7 +1217,7 @@ figet_dmi_test(){ # 12/10/2017
|
|||
text+="$idmi: - \n"
|
||||
fi
|
||||
done
|
||||
text+='```\n\n'
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
|
@ -1246,8 +1246,8 @@ figet_gpu(){ # thanks neofetch, assigne $fget_gpu # 09/10/2017
|
|||
}
|
||||
|
||||
# acpi via kernel, hardware monitor, assigne $fget_hw_nb $fget_hw
|
||||
figet_hw(){ # 12/10/2017
|
||||
local ihw ihwx text core fan autre nbf nbc input crit
|
||||
figet_hw(){ # 13/10/2017
|
||||
local ihw ihwx text core fan autre nbf nbc input crit hyst
|
||||
fget_hw_nb=$(grep -c . <<< $(ls /sys/class/hwmon/ 2>/dev/null)) # nb de ressources gérées via acpi/kernel
|
||||
if [ "$fget_hw_nb" -eq 0 ]; then
|
||||
fget_hw="gestion ACPI non acessible"
|
||||
|
@ -1259,27 +1259,28 @@ figet_hw(){ # 12/10/2017
|
|||
for ihw in $(ls /sys/class/hwmon/); do
|
||||
if grep -Eq 'fan[0-9]+' <<< $(ls /sys/class/hwmon/$ihw/) ; then
|
||||
nbf=$(( nbf+1 ))
|
||||
fan+="fan$nbf $(cat /sys/class/hwmon/$ihw/fan*_input)t/mn"
|
||||
fan+="fan$nbf $(cat /sys/class/hwmon/$ihw/fan*_input)t/mn"$' \n'
|
||||
elif grep -Eq 'temp[0-9]+' <<< $(ls /sys/class/hwmon/$ihw/) ; then
|
||||
input=$(gawk '{printf "%.1f", $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_input))
|
||||
crit=$(gawk '{printf "%.1f", $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_crit 2>/dev/null))
|
||||
hyst=$(gawk '$0!="" {printf "%.1f", $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_crit_hyst 2>/dev/null))
|
||||
if grep -q 'core' <<< $(cat /sys/class/hwmon/$ihw/name) ; then
|
||||
nbc=$(( nbc+1 ))
|
||||
input=$(awk '{print $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_input))
|
||||
crit=$(awk '{print $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_crit))
|
||||
core+="core$nbc $(printf "%.1f" $input)°C (crit: $(printf "%.1f" $crit)°C)"
|
||||
core+="core$nbc $input""°C (crit: $crit""°C)"
|
||||
[ "$hyst" ] && core+="($hyst""°C)"$' \n'
|
||||
else
|
||||
input=$(awk '{print $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_input))
|
||||
crit=$(awk '{print $1/1000}' <<< $(cat /sys/class/hwmon/$ihw/temp*_crit))
|
||||
autre+="$(cat /sys/class/hwmon/$ihw/name) $(printf "%.1f" $input)°C (crit: $(printf "%.1f" $crit)°C)"
|
||||
autre+="$(cat /sys/class/hwmon/$ihw/name) $input""°C (crit: $crit""°C)"
|
||||
[ "$hyst" ] && autre+="(hyst: $hyst""°C)"$' \n'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fget_hw="$core"$' \n'
|
||||
fget_hw+="$autre"$' \n'
|
||||
fget_hw+="$fan"
|
||||
fget_hw="$core"$' \n'"$autre"$' \n'"$fan"
|
||||
fget_hw=${fget_hw::-1} # suppression dernier $'\n'
|
||||
}
|
||||
|
||||
figet_hw_test(){ # 12/10/2017
|
||||
local ihw ihwx text
|
||||
figet_hw_test(){ # 13/10/2017
|
||||
local ihw ihwx text sensors
|
||||
[ "$(which sensors)" ] && sensors="$(sensors)"
|
||||
text="## hwmon test \n\n"
|
||||
text+='```\n'
|
||||
for ihw in $(ls /sys/class/hwmon/); do
|
||||
|
@ -1299,7 +1300,16 @@ figet_hw_test(){ # 12/10/2017
|
|||
done
|
||||
text+=" \n"
|
||||
done
|
||||
text+='```\n\n'
|
||||
text+='```\n'
|
||||
if [ "$sensors" ]; then
|
||||
text+='```\n'
|
||||
text+="$sensors \n"
|
||||
text+='```\n'
|
||||
fi
|
||||
figet_hw
|
||||
text+='```\n'
|
||||
text+="$fget_hw \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
|
@ -1421,8 +1431,8 @@ figet_ip_public(){ # 02/10/2017
|
|||
fi
|
||||
}
|
||||
|
||||
# $1=mem&|swap&|total&|notitle&|nocoltitle, assigne $fget_mem ($2=debug)
|
||||
figet_mem(){ # 12/10/2017
|
||||
# $1=mem|swap [total|notitle|nocoltitle], assigne $fget_mem ($2=debug all cols + free)
|
||||
figet_mem(){ # 13/10/2017
|
||||
local freeDebug MemTotal MemFree MemAvailable Buffers Cached SReclaimable Shmem MemUsed
|
||||
local SwapTotal SwapFree SwapCached col
|
||||
[ "$2" == "debug" ] && freeDebug="$(free -hw | sed '3d')"
|
||||
|
@ -1461,24 +1471,24 @@ figet_mem(){ # 12/10/2017
|
|||
unset fget_mem
|
||||
if [[ ! "$*" =~ notitle ]]; then
|
||||
[[ "$*" =~ nocoltitle ]] || col="mém.:"
|
||||
fget_mem="$col totale utilisée disponible"$'\n'
|
||||
fget_mem="$col totale utilisée disponible"$' \n'
|
||||
fi
|
||||
if [[ "$*" =~ mem ]]; then
|
||||
[[ "$*" =~ nocoltitle ]] || col="ram :"
|
||||
fget_mem+="$col$MemTotal$MemUsed$MemAvailable"$'\n'
|
||||
fget_mem+="$col$MemTotal$MemUsed$MemAvailable"$' \n'
|
||||
fi
|
||||
if [[ "$*" =~ swap ]]; then
|
||||
[[ "$*" =~ nocoltitle ]] || col="swap:"
|
||||
fget_mem+="$col$SwapTotal$SwapUsed$SwapFree"$'\n'
|
||||
fget_mem+="$col$SwapTotal$SwapUsed$SwapFree"$' \n'
|
||||
fi
|
||||
if [[ "$*" =~ total ]]; then
|
||||
[[ "$*" =~ nocoltitle ]] || col="tot.:"
|
||||
fget_mem+="$col$totalTotal$totalUsed$totalAvailable"$'\n'
|
||||
fget_mem+="$col$totalTotal$totalUsed$totalAvailable"$' \n'
|
||||
fi
|
||||
if [ "$2" == "debug" ]; then
|
||||
local espace=$(printf '% 6s')
|
||||
fget_mem="$espace""mém.: totale utilisée libre shared buffers cache disponible"$'\n'
|
||||
fget_mem+="$espace""ram :$MemTotal$MemUsed$MemFree$Shmem$Buffers$Cached$MemAvailable"$'\n'
|
||||
fget_mem="$espace""mém.: totale utilisée libre shared buffers cache disponible"$' \n'
|
||||
fget_mem+="$espace""ram :$MemTotal$MemUsed$MemFree$Shmem$Buffers$Cached$MemAvailable"$' \n'
|
||||
fget_mem=${fget_mem::-1} # suppression dernier $'\n'
|
||||
echo "$fget_mem"
|
||||
echo "$freeDebug"
|
||||
|
|
|
@ -4,10 +4,16 @@
|
|||
## todo
|
||||
|
||||
* placer ln dans /usr/local/bin au lieu de /usr/bin ?
|
||||
* disk: comptage, pluriel, renommage variables publiques
|
||||
* disk: comptage, pluriel, renommage variables publiques, révision, fin de lignes
|
||||
* figet_cpu, refaire si plusieurs core
|
||||
---
|
||||
|
||||
|
||||
## 2.4.0 13/10/2017
|
||||
|
||||
* révision: fix figet_hw_test +sensors si possible +figet_hw
|
||||
* fix: figet_hw formatage float
|
||||
|
||||
## 2.3.0 12/10/2017
|
||||
|
||||
* nouveau: figet_hw, figet_hw_test
|
||||
|
|
Loading…
Reference in New Issue