getInfo 2.17.0

This commit is contained in:
kyodev 2017-10-25 12:24:21 +02:00
parent 69b23dbc6b
commit d64ea1f8b5
2 changed files with 31 additions and 20 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.16.1
version=2.17.0
date="25/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -653,10 +653,16 @@ fi_journal(){ # 25/10/2017
}
fi_locale(){ # 25/10/2017
local locale timezone xKeyboardMap keyboard timedatectl alert_Rtc alert_Rtc_info alert_NTP alert_Ntp_info text
locale="$(grep -Ev '#|^$' /etc/default/locale)"
timezone="$(< /etc/timezone)"
if [ "$(f__cmd_exist timedatectl)" ]; then
local locale localectl timezone timedatectl
local xKeyboardMap keyboard alert_Rtc alert_Rtc_info alert_NTP alert_Ntp_info text
# locale
locale="$(grep -Esv '#|^$' /etc/default/locale* /etc/locale.conf)"
if [ "$(f__cmd_exist localectl)" ]; then
localectl=$(localectl --no-pager status)
fi
# timezone
timezone="$(grep -s . /etc/timezone)"
if [ "$(f__cmd_exist timedatectl)" ]; then
timedatectl="$(timedatectl status --no-pager)"
grep -q 'RTC in local TZ: yes' <<< "$timedatectl" && alert_Rtc="Attention RTC in local TZ"
alert_Rtc_info="**Lhorloge système doit être en UTC** pour que les applications de date et heure fonctionnent
@ -667,17 +673,26 @@ dété/hiver peuvent être incohérentes quand lhorloge matérielle est en
activer le service: timedatectl set-ntp true
et/ou installer le démon Ntp: apt install ntp \n"
fi
# keyboard layout
keyboard="$(grep -Esv '#|^$' /etc/default/keyboard)"
[ "$(f__cmd_exist setxkbmap)" ] && xKeyboardMap="$(setxkbmap -query)"
keyboard="$(grep -Ev '#|^$' /etc/default/keyboard)"
###
text="## localisation \n\n"
f_display "locale" "cmd" "grep -Ev '#|^$' /etc/default/locale"
f_display "timezone" "cmd" "cat /etc/timezone"
# locale
f_display "locale" "cmd" "grep -Esv '#|^$' /etc/default/locale* /etc/locale.conf"
f_display "localectl" "cmd" "localectl --no-pager status"
# timezone
f_display "timezone" "cmd" "grep -s . /etc/timezone*"
[ "$timedatectl" ] && f_display "timedatectl" "cmd" "timedatectl status --no-pager"
[ "$alert_Rtc" ] && text+="$alert_Rtc_info \n"
[ "$alert_Ntp" ] && text+="$alert_Ntp_info \n"
[ "$xKeyboardMap" ] && f_display "xKeyboardMap" "cmd" "setxkbmap -query"
# keyboard layout
f_display "keyboard" "cmd" "grep -Ev '#|^$' /etc/default/keyboard"
if [ "$xKeyboardMap" ]; then
f_display "xKeyboardMap" "cmd" "setxkbmap -query"
else
text+="**pas d'informations détectées** \n\n"
fi
printf "$text\n" >> "$fileOutput"
unset text
}
@ -787,7 +802,7 @@ fi_reseau(){ # 25/10/2017
# ip_a="$(sed '/inet6.*scope global/d; /inet6.*scope link/d' <<< $ip_a)" # filtre sur inet6 scope global & scope link (fe80::)
ip_a="$(sed '/inet6.*/d' <<< $ip_a)" # filtre sur inet6)
route="$(ip route show)"
interfaces="$(grep -Evrs '#|^$' /etc/network/interfaces*)"
interfaces="$(grep -Ersv '#|^$' /etc/network/interfaces*)"
interfaces="$(sed -E 's/wpa-psk [[:graph:]]+/wpa-psk <WPA key removed>/; s/:/: /' <<< $interfaces )"
resolv="$(grep -Ev '#|^$' /etc/resolv.conf)"
if [ "$(f__cmd_exist iwconfig)" ]; then #paquet wireless-tools requis
@ -824,7 +839,7 @@ fi_reseau(){ # 25/10/2017
fi
f_display "ip_a" "cmd" "ip address" "(sans ipV6 et sans adresses MAC)"
f_display "route" "cmd" "ip route show"
f_display "interfaces" "cmd" "grep -Evrs '#|^$' /etc/network/interfaces*"
f_display "interfaces" "cmd" "grep -Ersv '#|^$' /etc/network/interfaces*"
f_display "resolv" "cmd" "cat /etc/resolv.conf" "(serveurs de noms DNS utilisés)"
if [ "$iwconfig" ]; then
f_display "iwconfig" "cmd" "iwconfig"
@ -863,7 +878,7 @@ fi_sources(){ # 25/10/2017
local alert_upgradable alert_upgradable_text alert_nbUpgradable
local alert_paquetBiz alert_paquetBiz_text0 alert_paquetBiz_text
printf "."
sources="$(grep -Evrs '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list)"
sources="$(grep -Ersv '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list)"
sources="$(sed 's/:deb/: deb/; s/ / /g' <<< $sources)"
dateMaj="$(date -r /var/cache/apt/pkgcache.bin '+%d/%m/%Y %H:%M %z')" # /var/lib/dpkg/
nb_packages="$(dpkg -l | grep -c '^ii')"
@ -915,7 +930,7 @@ fi_sources(){ # 25/10/2017
fi
###
text="## sources liste \n\n"
f_display "sources" "cmd" "grep -Evrs '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list"
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list"
text+="nombre de paquets installés: **$nb_packages** \n\n"
text+="dernière mise à jour apt: **$dateMaj** \n\n"
[ "$alert_autoremove" ] && f_display "alert_paquetToRemove" "var" "$alert_autoremove"
@ -1082,11 +1097,6 @@ figet_batt(){ #v2 25/10/2017
batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_CHARGE_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mA
batt_conso="$(gawk -F '=' '/POWER_SUPPLY_CURRENT_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mA
elif grep -q 'POWER_SUPPLY_ENERGY_' <<< $uevent ; then
# batt_unit="mWh"
# batt_capa_design="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL_DESIGN=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_capa_full="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_conso="$(gawk -F '=' '/POWER_SUPPLY_POWER_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
batt_unit="Wh"
batt_capa_design="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL_DESIGN=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
batt_capa_full="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
@ -2105,7 +2115,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_batt
fi_locale
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -15,9 +15,10 @@
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
* f__cmd_exist f__sudo f__requis
## 2.16.1 25/10/2017
## 2.17.0 25/10/2017
* révision: batterie, unité en W au lieu de mW, mA inchangé
* fix: fi_locale compatible fedora
* fix, révision: modification complète des séquences peuplement rapport et modules fi_* autonomes
* fix: bug affichage disque sata