mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.59.4
This commit is contained in:
parent
ffe80951df
commit
b4f33a0f44
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version=2.59.3
|
version=2.59.4
|
||||||
date="9/12/2017"
|
date="9/12/2017"
|
||||||
projet="simpledeb"
|
projet="simpledeb"
|
||||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||||
|
@ -675,7 +675,7 @@ fi_batt(){ # 9/12/2017
|
||||||
local pluriel
|
local pluriel
|
||||||
|
|
||||||
[ "$fg_batt" ] || figet_batt
|
[ "$fg_batt" ] || figet_batt
|
||||||
[[ "$fg_batt" || "$fg_nb_batt" -gt 0 ]] || return 0 # pas de batterie
|
[ "$fg_batt" ] || return 0 # pas de batterie
|
||||||
[ "$fg_nb_batt" -gt 1 ] && pluriel="s" || unset pluriel
|
[ "$fg_nb_batt" -gt 1 ] && pluriel="s" || unset pluriel
|
||||||
###
|
###
|
||||||
f_pr titre2 "batterie"$pluriel
|
f_pr titre2 "batterie"$pluriel
|
||||||
|
@ -2225,21 +2225,19 @@ fi_vrms(){ # 1/12/2017
|
||||||
|
|
||||||
# informations batterie(s), assigne $fg_nb_batt $fg_batt $fg_batt_serial
|
# informations batterie(s), assigne $fg_nb_batt $fg_batt $fg_batt_serial
|
||||||
figet_batt(){ #v2 9/12/2017
|
figet_batt(){ #v2 9/12/2017
|
||||||
local batt_detail batt_nb batt_unit batt_capa_design batt_capa_full batt_capa_now batt_conso
|
local batt_detail batt_unit batt_capa_design batt_capa_full batt_capa_now batt_conso
|
||||||
local batt_volt_min batt_volt_now batt_status batt_cycle alert_batt_alarm
|
local batt_volt_min batt_volt_now batt_status batt_cycle alert_batt_alarm
|
||||||
local batt_sante batt_restant tempo batRep ibat uevent
|
local batt_sante batt_restant tempo batRep ibat uevent
|
||||||
|
fg_nb_batt=0
|
||||||
if [ ! -d /sys/class/power_supply ]; then # anciennes interfaces ou inconnu
|
if [ ! -d /sys/class/power_supply ]; then # anciennes interfaces ou inconnu
|
||||||
[ -d /proc/acpi/battery ] && batt_detail="ancienne interface ACPI non gérée (obsolète)"
|
[ -d /proc/acpi/battery ] && fg_batt="ancienne interface ACPI non gérée (obsolète)"
|
||||||
[ -e /proc/apm ] && batt_detail="anciennes batteries APM non gérées (obolète)"
|
[ -e /proc/apm ] && fg_batt="anciennes batteries APM non gérées (obolète)"
|
||||||
[ "$batt_detail" ] || batt_detail="répertoire power_supply inaccessible"
|
[ "$fg_batt" ] || fg_batt="répertoire power_supply inaccessible"
|
||||||
batt_nb="-1"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
[ "$(grep -c 'BAT' <<< $(ls /sys/class/power_supply/ 2>/dev/null))" -gt 0 ] || return 0
|
fg_nb_batt="$(grep -i 'Battery' /sys/class/power_supply/*/type | grep -c .)"
|
||||||
batt_nb="$(grep -i 'Battery' /sys/class/power_supply/*/type | grep -c .)"
|
if [ "$fg_nb_batt" -eq 0 ]; then
|
||||||
if [ "$batt_nb" ]; then
|
return 0
|
||||||
fg_nb_batt=0
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
batRep="/sys/class/power_supply"
|
batRep="/sys/class/power_supply"
|
||||||
unset batt_detail
|
unset batt_detail
|
||||||
|
@ -2318,9 +2316,12 @@ figet_batt(){ #v2 9/12/2017
|
||||||
batt_detail+="batterie très mal chargée (moins de 50%): mauvais état? "$'\n' #[ln 5]
|
batt_detail+="batterie très mal chargée (moins de 50%): mauvais état? "$'\n' #[ln 5]
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fg_nb_batt=$(( "$batt_nb" )) # force en numérique
|
if [ "$batt_detail" ]; then
|
||||||
[ "$batt_detail" ] && fg_batt=${batt_detail::-1} # suppression dernier $'\n'
|
fg_batt=${batt_detail::-1} # suppression dernier $'\n'
|
||||||
[ "$(xargs <<< $fg_batt_serial)" ] || fg_batt_serial+="n/a"
|
fi
|
||||||
|
if [ -z "$(xargs <<< $fg_batt_serial)" ] ; then
|
||||||
|
fg_batt_serial+="n/a"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu
|
# assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu
|
||||||
|
@ -3326,23 +3327,22 @@ figet_lspci(){ # 8/12/2017
|
||||||
# indépendant de procps, affichage plus clair que free, mais résultats identiques
|
# indépendant de procps, affichage plus clair que free, mais résultats identiques
|
||||||
figet_mem(){ # 9/12/2017
|
figet_mem(){ # 9/12/2017
|
||||||
local freeDebug MemTotal MemFree MemAvailable Buffers Cached SReclaimable Shmem MemUsed
|
local freeDebug MemTotal MemFree MemAvailable Buffers Cached SReclaimable Shmem MemUsed
|
||||||
local SwapTotal SwapFree SwapCached col a b
|
local SwapTotal SwapFree SwapCached col a b c MemLibre
|
||||||
[ "$2" == "debug" ] && freeDebug="$(free -hw | sed '3d')"
|
[ "$2" == "debug" ] && freeDebug="$(free -hw | sed '3d')"
|
||||||
IFS=':'
|
while read a b c; do
|
||||||
while read a b; do
|
[ "$a" == "MemTotal:" ] && MemTotal="$b" #echo "$a $((${b/kB}/1024))" ! partie entière !
|
||||||
[ "$a" == "MemTotal" ] && MemTotal=$(( ${b/kB} )) #echo "$a $((${b/kB}/1024))" ! partie entière !
|
[ "$a" == "MemAvailable:" ] && MemAvailable="$b"
|
||||||
[ "$a" == "MemAvailable" ] && MemAvailable=$(( ${b/kB} ))
|
[ "$a" == "MemFree:" ] && MemFree="$b"
|
||||||
[ "$a" == "MemFree" ] && MemFree=$(( ${b/kB} ))
|
[ "$a" == "Buffers:" ] && Buffers="$b"
|
||||||
[ "$a" == "Buffers" ] && Buffers=$(( ${b/kB} ))
|
[ "$a" == "Cached:" ] && Cached="$b"
|
||||||
[ "$a" == "Cached" ] && Cached=$(( ${b/kB} ))
|
[ "$a" == "SReclaimable:" ] && SReclaimable="$b"
|
||||||
[ "$a" == "SReclaimable" ] && SReclaimable=$(( ${b/kB} ))
|
[[ "$a" =~ Shmem$|MemShared$ ]] && Shmem="$b" # = free shared
|
||||||
[[ "$a" =~ Shmem$|MemShared$ ]] && Shmem=$(( ${b/kB} )) # = free shared
|
[ "$a" == "SwapTotal:" ] && SwapTotal="$b"
|
||||||
[ "$a" == "SwapTotal" ] && SwapTotal=$(( ${b/kB} ))
|
[ "$a" == "SwapFree:" ] && SwapFree="$b"
|
||||||
[ "$a" == "SwapFree" ] && SwapFree=$(( ${b/kB} ))
|
[ "$a" == "SwapCached:" ] && SwapCached="$b"
|
||||||
[ "$a" == "SwapCached" ] && SwapCached=$(( ${b/kB} ))
|
|
||||||
done <<< $(< /proc/meminfo)
|
done <<< $(< /proc/meminfo)
|
||||||
IFS="$IFS_INI"
|
MemLibre=$(( $MemFree + $Buffers + $Cached + $SReclaimable ))
|
||||||
MemUsed=$(( $MemTotal-($MemFree+$Buffers+$Cached+$SReclaimable) ))
|
MemUsed=$(( $MemTotal - $MemLibre ))
|
||||||
SwapUsed=$(( $SwapTotal-$SwapFree ))
|
SwapUsed=$(( $SwapTotal-$SwapFree ))
|
||||||
totalTotal=$(( $MemTotal+$SwapTotal ))
|
totalTotal=$(( $MemTotal+$SwapTotal ))
|
||||||
totalUsed=$(( $MemUsed+$SwapUsed ))
|
totalUsed=$(( $MemUsed+$SwapUsed ))
|
||||||
|
@ -3996,7 +3996,7 @@ for j in $options; do
|
||||||
ORIGIN='test'
|
ORIGIN='test'
|
||||||
prg_1 "$*"
|
prg_1 "$*"
|
||||||
echo -n "•"
|
echo -n "•"
|
||||||
fi_system
|
fi_mem
|
||||||
echo; f_dspl_md "$fileOutput"
|
echo; f_dspl_md "$fileOutput"
|
||||||
exit ;; # test
|
exit ;; # test
|
||||||
-c* | all )
|
-c* | all )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# changelog getInfo
|
# changelog getInfo
|
||||||
|
|
||||||
## getInfo 2.59.3 9/12/2017
|
## getInfo 2.59.4 9/12/2017
|
||||||
|
|
||||||
* révision: fi_system si plusieurs batteries
|
* révision: fi_system si plusieurs batteries
|
||||||
* fix: figet_batt, protection format numérique
|
* fix: figet_batt, protection format numérique
|
||||||
|
|
Loading…
Reference in New Issue