mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.31.0
This commit is contained in:
parent
fe7528245b
commit
ac4da98c47
140
scripts/getInfo
140
scripts/getInfo
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=2.30.1
|
||||
version=2.31.0
|
||||
date="11/11/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
|
@ -369,7 +369,7 @@ f_dspl_alert(){ # 10/11/2017
|
|||
# l'italique avec _ ou * n'est pas géré, trop d'interférences potentielles
|
||||
# liste niveau2: 3 ou 4 caractères, niveau3: 6 ou 8 caractères, puce * ou -
|
||||
f_dspl_md(){ # 11/11/2017
|
||||
local display display2 ifs_origin
|
||||
local display display2 ifs_origin ligne
|
||||
if [ ! -f "$1" ]; then
|
||||
f__info "pas de rapport à afficher, vous devez lancer une analyse auparavant:" \
|
||||
"$GREEN$script -l$BLUE ou afficher l'aide $GREEN$script -h"
|
||||
|
@ -1035,7 +1035,8 @@ fi_hw(){ # 10/11/2017
|
|||
|
||||
fi_journal(){ # 10/11/2017
|
||||
local jctl_boot jctl_alert_k jctl_crit_k jctl_err_k jctl_warn_k jctl_warn_nok jctl_size file
|
||||
local alert_jctl_persist text nb_lignes=25
|
||||
local text nb_lignes=25
|
||||
local alert_jctl_persist
|
||||
[ "$(f__cmd_exist journalctl)" ] || fi_dmesg # pas systemd, appel dmesg
|
||||
file="/tmp/$$-$RANDOM-journalctl"
|
||||
[ "$EUID" -eq 0 ] || echo
|
||||
|
@ -1106,8 +1107,8 @@ fi_journal(){ # 10/11/2017
|
|||
}
|
||||
|
||||
fi_locale(){ # 10/11/2017
|
||||
local locale localectl timezone timedatectl
|
||||
local xKeyboardMap keyboard alert_rtc alert_ntp text
|
||||
local locale localectl timezone timedatectl xKeyboardMap keyboard text
|
||||
local alert_rtc alert_ntp
|
||||
# locale
|
||||
locale="$(f_grep_file "/etc/default/locale* /etc/locale.conf")"
|
||||
[ "$(f__cmd_exist localectl)" ] && localectl=$(localectl --no-pager status)
|
||||
|
@ -1219,7 +1220,8 @@ fi_nm(){ # 10/11/2017
|
|||
}
|
||||
|
||||
fi_reseau(){ # 11/11/2017
|
||||
local slots cards ip_a iwconfig interfaces route resolv canal_wifi ifx alert_wlx text pluriel
|
||||
local slots cards ip_a iwconfig interfaces route resolv canal_wifi ifx text pluriel
|
||||
local alert_wlx alert_ifconfig
|
||||
# cardsManuel="$(lspci -nnk | grep -EiA 5 'network|ethernet')"
|
||||
# cardsManuel="$(lspci -nnv | grep -EiA 15 'network|ethernet')"
|
||||
# cardsManuel="lspci -nnv -s $( lspci | grep -Ei 'network|ethernet' | cut -d" " -f1 )" si devices plusieurs slots???
|
||||
|
@ -1263,6 +1265,10 @@ fi_reseau(){ # 11/11/2017
|
|||
alert_wlx+="éventuellement, changer le renommage: \n"
|
||||
alert_wlx+="https://kyodev.frama.io/kyopages/trucs/interfaces-nommage-classique/"
|
||||
fi
|
||||
if [ $(f__cmd_exist ifconfig) ] ; then
|
||||
alert_ifconfig="ifconfig [net-tools](https://github.com/giftnuss/net-tools) est un projet abandonné "
|
||||
alert_ifconfig=+"depuis des années. iproute2 (linuxfoundation) le remplace."
|
||||
fi
|
||||
[ "$fg_mod_net" ] || figet_mod_net
|
||||
###
|
||||
text="## réseau \n\n"
|
||||
|
@ -1311,6 +1317,7 @@ fi_reseau(){ # 11/11/2017
|
|||
text+="### modules réseau \n\n"
|
||||
f_display "fg_mod_net" "var" "liste non garantie complète"
|
||||
[ "$fg_mod_net" ] || text+="**Modules chargés non reconnus**"
|
||||
f_dspl_alert "alert_ifconfig" "info"
|
||||
printf "$text\n" >> "$fileOutput"
|
||||
unset text
|
||||
}
|
||||
|
@ -1465,9 +1472,10 @@ fi_system_analyse(){ # 08/11/2017
|
|||
unset text
|
||||
}
|
||||
|
||||
fi_systeme(){ # 10/11/2017
|
||||
fi_systeme(){ # 11/11/2017
|
||||
local mbr uname bootImage initDaemon xorg shells lastboot uptime charge pluriel text
|
||||
local alim_total alimentation
|
||||
local alimentation alim_total ish ifs_origin ligne date_install
|
||||
local alert_SLiM alert_microcode microcode
|
||||
[ -d /sys/firmware/efi ] && mbr="EFI" || mbr="Legacy (mbr)"
|
||||
uname="$(uname -rmo)"
|
||||
bootImage="$(gawk '/BOOT_IMAGE/ {print $1}' /proc/cmdline)"
|
||||
|
@ -1477,7 +1485,11 @@ fi_systeme(){ # 10/11/2017
|
|||
if [ -z "$xorg" ]; then
|
||||
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && xorg="wayland" || xorg="indéterminé"
|
||||
fi
|
||||
shells="$(f_grep_file "/etc/shells" "file" | tr '\n' ' ')"
|
||||
for ish in $(f_grep_file "tests/shells" "file"); do
|
||||
shells+=${ish##*/}" " # conservation dernier "champs", ifs '/'
|
||||
done
|
||||
shells=${shells%% } # suppression espace de fin
|
||||
shells=$(tr ' ' '\n' <<< $shells | sort -u | tr '\n' ' ') # tri et suppression doublons
|
||||
if [ $(grep -c 'AC' <<< $(ls /sys/class/power_supply/ 2>/dev/null)) -gt 0 ]; then
|
||||
alim_total=$(grep -cs . <<< $(ls /sys/class/power_supply/AC*/online))
|
||||
alimentation=$( gawk -v "alim_total=$alim_total" '
|
||||
|
@ -1486,25 +1498,50 @@ fi_systeme(){ # 10/11/2017
|
|||
if ( alim_total != alim_on ) print ", " alim_on " branchée" pllo; else print "" }
|
||||
' /sys/class/power_supply/AC*/online )
|
||||
fi
|
||||
while read ligne; do
|
||||
date_install=$ligne
|
||||
done <<< $(ls -lt --time-style '+FORMAT %d/%m/%Y' /)
|
||||
[[ "$date_install" =~ .*([0-9]{2}/[0-9]{2}/[0-9]{4}).* ]] && date_install=${BASH_REMATCH[1]}
|
||||
# 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) # uptime tempo pour charge
|
||||
charge=${uptime/*average: } # suppression jusqu'à average:
|
||||
charge=${charge//, / } # remplacement global ', ' par ' '
|
||||
charge=${charge//,/.} # remplacement global , par .
|
||||
uptime=${uptime%%,[[:blank:]]*} # uptime -p parfois inexistant (alpine), suppression depuis ,[blancs]* (fin)
|
||||
uptime="$( sed 's/up/depuis/; s/week/semaine/; s/weeks/semaines/; s/days/jours/; s/day/jour/;
|
||||
s/hour[s]*/h/; s/minute[s]*/mn/' <<< $uptime )"
|
||||
[ "$fg_nb_batt" ] || figet_batt
|
||||
[ "$fg_cpu" ] || figet_cpu
|
||||
[ "$fg_de" ] || figet_de
|
||||
[ "$fg_dmi" ] || figet_dmi
|
||||
[ "$fg_nb_disk" ] || figet_disk
|
||||
[ "$fg_distrib" ] || figet_distrib
|
||||
[ "$fg_nb_gpu" ] || figet_gpu
|
||||
uptime=$(uptime)
|
||||
charge=${uptime/*average: } # suppression jusqu'à 'average: '
|
||||
charge=${charge//, / } # remplacement global ', ' par ' '
|
||||
charge=${charge//,/.} # remplacement global , par .
|
||||
uptime=${uptime%%, *} # uptime -p parfois inexistant (alpine), suppression à la fin de ',[blancs]*' -> conservation premier 'champs' ifs ', '
|
||||
uptime=${uptime/*up /depuis } # suppression début jusqu'à 'up '
|
||||
uptime=${uptime//weeks/semaines} # remplacement global
|
||||
uptime=${uptime//week/semaine} # remplacement global
|
||||
uptime=${uptime//days/jours} # remplacement global
|
||||
uptime=${uptime//day/jour} # remplacement global
|
||||
uptime=${uptime//hours/h} # remplacement global
|
||||
uptime=${uptime//hour/h} # remplacement global
|
||||
uptime=${uptime//minutes/mn} # remplacement global
|
||||
uptime=${uptime//minute/mn} # remplacement global
|
||||
[ "$fg_nb_batt" ] || figet_batt
|
||||
[ "$fg_cpu" ] || figet_cpu
|
||||
[ "$fg_de" ] || figet_de
|
||||
[ "$fg_nb_disk" ] || figet_disk
|
||||
[ "$fg_distrib" ] || figet_distrib
|
||||
[ "$fg_dsp_mngr" ] || figet_dm
|
||||
[ "$fg_dmi" ] || figet_dmi
|
||||
[ "$fg_nb_gpu" ] || figet_gpu
|
||||
[ "$fg_resolution" ] || figet_screen
|
||||
[ "$fg_shell" ] || figet_shell
|
||||
[ "$fg_wm" ] || figet_wm
|
||||
[ "$fg_shell" ] || figet_shell
|
||||
[ "$fg_wm" ] || figet_wm
|
||||
if [[ "$fg_dsp_mngr" =~ "slim" || "$fg_dsp_mngr_actif" =~ "slim" ]]; then
|
||||
alert_SLiM="SLiM est un projet abandonné et peu compatible avec systemd"
|
||||
fi
|
||||
f__requis "intel-microcode amd64-microcode" "debOnly"
|
||||
#
|
||||
# si $2=debOnly et si paquets manquants: return 1 et $debOnlyPackages ( $1=liste paquets )
|
||||
# si $2=debOnly et si paquets présent: return 0 et $debOnlyPresents ( $1=liste paquets )
|
||||
#$1 liste commande[>paquet] (ex: killall>psmisc)
|
||||
if [[ "$debOnlyPackages" =~ $fg_vendor ]]; then
|
||||
[ "$fg_vendor" == "amd" ] && microcode="amd64-microcode" || microcode="intel-microcode"
|
||||
alert_microcode="microcodes $fg_vendor non installés (corrections bugs du processeur), "
|
||||
alert_microcode+="les installer: \n apt install $microcode"
|
||||
fi
|
||||
###
|
||||
f__architecture || f__info "Architecture non supportée" "vous pouvez contacter $projet, $contact " \
|
||||
"pour aider à parfaire le script"
|
||||
|
@ -1522,11 +1559,15 @@ fi_systeme(){ # 10/11/2017
|
|||
text+="architecture système: $architecture \n"
|
||||
text+="uname: $uname \n"
|
||||
text+="$bootImage \n"
|
||||
text+="date d'installation: $date_install \n"
|
||||
text+="démon d'initialisation: $initDaemon \n"
|
||||
text+="serveur d'affichage: $xorg \n"
|
||||
text+="nombre d'écrans: $fg_nb_screen \n"
|
||||
[ "$(f__wcv "-wv" "$fg_resolution" "pixels")" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
text+="résolution"$pluriel": $fg_resolution \n"
|
||||
[ "$(wc -w <<< $fg_dsp_mngr)" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
text+="display manager"$pluriel": $fg_dsp_mngr \n"
|
||||
[ "$fg_dsp_mngr_actif" != "$fg_dsp_mngr" ] && text+="display manager actif: $fg_dsp_mngr_actif \n"
|
||||
text+="desktop (DE): $fg_de \n"
|
||||
text+="window manager: $fg_wm \n"
|
||||
text+="shell actif: $fg_shell \n"
|
||||
|
@ -1541,6 +1582,8 @@ fi_systeme(){ # 10/11/2017
|
|||
text+="dernier boot: $lastboot, uptime: $uptime \n"
|
||||
text+="charge système depuis les 1, 5 et 15 dernières minutes: $charge ($fg_nb_threads threads) \n"
|
||||
text+='``` \n\n'
|
||||
f_dspl_alert "alert_SLiM" "info"
|
||||
f_dspl_alert "alert_microcode" "info"
|
||||
printf "$text\n" >> "$fileOutput"
|
||||
unset text
|
||||
}
|
||||
|
@ -1684,7 +1727,7 @@ figet_batt(){ #v2 11/11/2017
|
|||
[ "$(xargs <<< $fg_batt_serial)" ] || fg_batt_serial+="n/a"
|
||||
}
|
||||
|
||||
# assigne $fg_cpu (3 lignes description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch
|
||||
# assigne $fg_cpu (3 lignes description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=amd|intel
|
||||
figet_cpu(){ #v2 05/11/2017
|
||||
local cpuinfo speedNom speedMax speedMin speedCpu cpu1 cpu2 cpu3
|
||||
cpuinfo="$(cat /proc/cpuinfo)"
|
||||
|
@ -1736,6 +1779,8 @@ figet_cpu(){ #v2 05/11/2017
|
|||
[ $(grep -cm1 'flags.* lm ' /proc/cpuinfo) -ge 1 ] && fg_cpu_arch="64bits" || fg_cpu_arch="32bits"
|
||||
# traitement µarchitecture
|
||||
figet_cpu_uarch
|
||||
[[ ${fg_cpu,,} =~ amd ]] && fg_vendor="amd"
|
||||
[[ ${fg_cpu,,} =~ intel ]] && fg_vendor="intel"
|
||||
}
|
||||
|
||||
# dépend de figet_cpu ($cpuinfo), appel via figet_cpu, assigne $fg_uarch
|
||||
|
@ -2008,6 +2053,43 @@ figet_distrib(){ # 01/11/2017
|
|||
[ "$fg_distrib" ] || fg_distrib="${OS^} (indéterminé)"
|
||||
}
|
||||
|
||||
# display manager, assigne $fg_dsp_mngr (liste) ou 'n/a', $fg_dsp_mngr_actif
|
||||
figet_dm(){ #v1 11/11/2017
|
||||
local dm_list="cdm entranced gdm3 gdm qingy kdm ldm lightdm lxdm mdm nodm orthos sddm slim wdm xdm"
|
||||
local idm ps_aux systemctl x11
|
||||
fg_dsp_mngr=""
|
||||
ps_aux=$(ps -auxf)
|
||||
ps_aux=${ps_aux,,} # tout en minuscules
|
||||
for idm in $dm_list; do
|
||||
# if grep -iq "bin/$idm" <<< "$ps_aux"; then
|
||||
if [ "${ps_aux/*"$idm"*/test}" == "test" ]; then # fun & speed? grepless (remplacement $idm et alentours, si idm présent, valeur test)
|
||||
fg_dsp_mngr+="$idm "
|
||||
fg_dsp_mngr_actif="$idm"
|
||||
elif [[ -e /var/run/$idm".pid" || -e /var/run/$idm".pid" || -e /run/$idm || -e /run/$idm || -d /run/$idm/ || -d /var/run/$idm/ ]]; then
|
||||
fg_dsp_mngr+="$idm "
|
||||
fg_dsp_mngr_actif="$idm"
|
||||
fi
|
||||
done
|
||||
fg_dsp_mngr=${fg_dsp_mngr// } # supression espaces
|
||||
if [[ -z "$fg_dsp_mngr" && -e "/etc/X11/default-display-manager" ]]; then
|
||||
x11=$(cat /etc/X11/default-display-manager)
|
||||
fg_dsp_mngr=${x11##*/} # conservation dernier champs ifs '/'
|
||||
fi
|
||||
if [[ -z "$fg_dsp_mngr" && "${ps_aux/*startx*/test}" == "test" ]]; then
|
||||
fg_dsp_mngr="(startx)"
|
||||
fg_dsp_mngr_actif="(startx)"
|
||||
fi
|
||||
if [[ -z "$fg_dsp_mngr_actif" && $(type -p systemctl) ]]; then
|
||||
fg_dsp_mngr_actif=$(grep 'Main PID' <<< $(systemctl status display-manager))
|
||||
fg_dsp_mngr_actif=${fg_dsp_mngr_actif##* } # conservation dernier champs ifs ' '
|
||||
fg_dsp_mngr_actif=${fg_dsp_mngr_actif/\(/} # suppression (
|
||||
fg_dsp_mngr_actif=${fg_dsp_mngr_actif/\)/} # suppression )
|
||||
[ ${fg_dsp_mngr// } ] || fg_dsp_mngr="$fg_dsp_mngr_actif"
|
||||
fi
|
||||
[ ${fg_dsp_mngr// } ] || fg_dsp_mngr="n/a"
|
||||
[ "$fg_dsp_mngr_actif" ] || fg_dsp_mngr_actif="n/a"
|
||||
}
|
||||
|
||||
# informations DMI, (firmware partie matériel), assigne $fg_dmi
|
||||
figet_dmi(){ #v2 06/11/2017
|
||||
local product board bios tempo idmi indic1="" indic2=""
|
||||
|
@ -2278,7 +2360,7 @@ figet_ip_pub(){ # 27/10/2017
|
|||
# indépendant de procps, affichage plus clair que free, mais résultats identiques
|
||||
figet_mem(){ # 09/11/2017
|
||||
local freeDebug MemTotal MemFree MemAvailable Buffers Cached SReclaimable Shmem MemUsed ifs_origin
|
||||
local SwapTotal SwapFree SwapCached col
|
||||
local SwapTotal SwapFree SwapCached col a b
|
||||
[ "$2" == "debug" ] && freeDebug="$(free -hw | sed '3d')"
|
||||
ifs_origin=$IFS
|
||||
IFS=':'
|
||||
|
@ -2756,7 +2838,7 @@ function display_menu {
|
|||
tput hpa $centre
|
||||
printf '%.'$larg's' "$2"
|
||||
}
|
||||
|
||||
|
||||
printf " $GREEN$script -h$STD : afficher l'aide \n"
|
||||
display_menu "$GREEN$script -c$RED""s$STD : catégorie système" \
|
||||
"$GREEN$script -c$RED""c$STD : catégorie configuration"
|
||||
|
@ -2859,7 +2941,7 @@ for j in $options; do
|
|||
case $j in
|
||||
-t | --test )
|
||||
prg_1 "$*"
|
||||
fi_vrms
|
||||
fi_systeme
|
||||
exit ;; # test
|
||||
-c* | all )
|
||||
[ "$j" == "-c" ] && exec $0 "menu"
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
* ! f__requis, fscript_install, f__scandir
|
||||
|
||||
|
||||
## 2.31.0 11/11/2017
|
||||
|
||||
## 2.30.1 11/11/2017
|
||||
|
||||
* nouveau: figet_dm, display managers oubliés
|
||||
* révision: fi_systeme, + date installation
|
||||
* révision: shells meilleure extraction pour autres linux, tri, sans doublons
|
||||
* révision: uptime meilleur affichage
|
||||
* révision: fi_vrms
|
||||
* fix: détection paquet non installés
|
||||
|
||||
|
|
Loading…
Reference in New Issue