getInfo 2.21.1

This commit is contained in:
kyodev 2017-10-30 10:50:22 +01:00
parent 62bd53fd94
commit bee86ae112
2 changed files with 69 additions and 61 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.21.0
version=2.21.2
date="30/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -302,14 +302,15 @@ f__wget_test(){ # 17/10/2017
exit 0
}
# f_display: $1 variable à afficher, $2=var|cmd|sans|-- (type titrage) [$3 titrage] [$4 commentaire en gras si cmd]
# f_display: $1 variable à afficher, $2=var|cmd|sans (type titre) [$3 titre] [$4 commentaire en gras si cmd]
# f_display "variable" "type" "titrage" "titrage_commentaire"
# $2: cmd->`titre`, var->**titre**, sans: pas de titre
f_display(){ # 30/10/2017
[ "$text" ] && echo -en "$text" >> "$fileOutput" # flush avant fonction de text parent
[ "$text" ] && echo -en "$text" >> "$fileOutput" # flush, avant fonction, de text parent
unset text
local display=""
[[ "$2" == "sans" ||"$2" == "--" || "$2" == "var" || "$2" == "cmd" ]] || display="erreur script \$2 ($1 $2 $3)"
[ "$2" == "var" ] && display="*-*$3** \n"
[[ "$2" =~ sans|var|cmd ]] || display="erreur script \$2 ($1 $2 $3) \n"
[ "$2" == "var" ] && display="**$3** \n"
[ "$2" == "cmd" ] && display="\`$3\` \n"
#echo $(sed -En 's/[^/]*(\/.*)$/\1/p' <<< "$3")
[[ "$2" == "cmd" && "$4" ]] && display="\`$3\` **$4** \n"
@ -398,7 +399,7 @@ fi_cpu(){ # 25/10/2017
unset text
}
fi_disk(){ # 29/10/2017
fi_disk(){ # 30/10/2017
local disk_lsblk disk_df disk_df_i fstab resume idResume idSwap alert_uuidResume text pluriel
local dd_temp dd_temp_alert dd_temp idisk tempodd
disk_lsblk="$(lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT,UUID)"
@ -411,7 +412,7 @@ fi_disk(){ # 29/10/2017
resume="Pas de fichier _resume_ dans /etc/initramfs-tools/conf.d/ \n"
resume+="Ce n'est pas (forcément) une erreur. \n"
resume+="La plus grosse partition swap est choisie dans ce cas. \n"
resume+="À investiguer si erreur au boot ou boot très long. \n"
resume+="À investiguer si erreur au boot ou boot très long. "
fi
idResume="$(grep -Evs '^[[:blank:]]*#|^$' /etc/initramfs-tools/conf.d/resume | sed -En 's/.*UUID=([0-9a-Z-]*).*$/\1/p')"
idSwap="$(grep -Ev '^[[:blank:]]*#|^$' /etc/fstab | sed -En 's/UUID=([0-9a-Z-]*).*swap.*$/\1/p')"
@ -529,7 +530,7 @@ fi_dmesg(){ # 25/10/2017
}
fi_graph(){ # 30/10/2017
local slots cards prefix_cmd cmd alert_hybrid alert_3D providers preferred current openGl resolutions text
local slots cards cmd alert_hybrid alert_3D providers preferred current openGl resolutions text
local ig modules glx_dev glx_temp
# cardsManuel="$(lspci -nnk | grep -EiA 3 'vga|display|3d')" # -nn: textual and numeric ID's, k kernel
# cardsManuel="$(lspci -nnv | grep -iEA11 'vga|display|3d)" # v=verbose
@ -538,18 +539,26 @@ fi_graph(){ # 30/10/2017
slots="$(lspci | grep -Ei 'vga|display|3d' | cut -d" " -f1)"
# si mult-cartes
[ "$fg_nb_cpu" ] || figet_gpu
# lspci
if [ "$fg_nb_cpu" -gt 1 ]; then
if [ $(f__cmd_exist optirun) ]; then
prefix_cmd="optirun "
for ig in $slots; do
cards+="$(optirun lspci -nnv -s $ig)"$'\n'
done
cmd="optirun lspci -nnv | grep -iEA11 'vga|display|3d'" # commande à afficher dans le rapport
else
prefix_cmd="DRI_PRIME=1 "
for ig in $slots; do
cards+="$(DRI_PRIME=1 lspci -nnv -s $ig)"$'\n'
done
cmd="DRI_PRIME=1 lspci -nnv | grep -iEA11 'vga|display|3d'" # commande à afficher dans le rapport
fi
cards=${cards::-1} # suppression dernier $'\n'
else
for ig in $slots; do
cards+="$(lspci -nnv -s $ig)"$'\n'
done
cmd="lspci -nnv | grep -iEA11 'vga|display|3d'" # commande à afficher dans le rapport
fi
# lspci
for ig in $slots; do
cards+="$($prefix_cmd lspci -nnv -s $ig)"$'\n'
done
cards=${cards::-1} # suppression dernier $'\n'
cmd="$prefix_cmd lspci -nnv | grep -iEA11 'vga|display|3d'" # commande à afficher dans le rapport
if [ $(grep -c 'Unknown header type 7f' <<< "$cards") -gt 0 ]; then
alert_hybrid="Une carte graphique est désactivée actuellement, lspci n'est pas complet. \n"
@ -564,7 +573,7 @@ fi_graph(){ # 30/10/2017
[ $(f__cmd_exist optirun) ] && glx_temp="$(optirun glxinfo | grep 'Device: ' | xargs)"
[ "$glx_dev" != "$glx_temp" ] && glx_dev="$glx_dev"$'\n'"$glx_temp"
fi
openGl=$( glxinfo | grep -i 'direct rendering' ) # variable rectclée plus tard
openGl=$( glxinfo | grep -i 'direct rendering' ) # variable recyclée plus tard
alert_3D=$(grep -i 'no' <<< $openGl )
[ "$alert_3D" ] && alert_3D="l'accélération 3D n'est pas active \n\n"
glx_dev+="\n${openGl^}"
@ -585,19 +594,19 @@ fi_graph(){ # 30/10/2017
modules="$(lsmod | grep -Ei 'amdgpu|ati|i915|nouveau|nvidia|radeon|video|gma')"
# fonctions externes
[ "$fg_gpu" ] || figet_gpu
[ "$fget_resolution" ] || figet_screen
[ "$fg_resolution" ] || figet_screen
###
[ "$(xargs <<< $fg_gpu)" ] && text="## graphisme \n\n" || text="## graphisme (incomplet) \n\n"
[ "$fg_gpu" ] && text="## graphisme \n\n" || text="## graphisme (incomplet) \n\n"
# cartes graphiques
[ "$fg_gpu" ] && text+="$(sed -E 's/(.*)/> \* \*\*\1\*\*/' <<< $fg_gpu) \n\n"
# nb écran & résolution(s) active(s)
text+="nombre d'écrans: **$fget_nb_screen** \n"
text+="résolution: **$fget_resolution** \n\n"
text+="nombre d'écrans: **$fg_nb_screen** \n"
text+="résolution: **$fg_resolution** \n\n"
# lspci
[ "$cards" ] && f_display "cards" "cmd" "$cmd"
[ "$alert_hybrid" ] && text+="$alert_hybrid \n\n"
# openGl
[ "$glx_dev" ] && f_display "glx_dev" "--"
[ "$glx_dev" ] && f_display "glx_dev" "toto"
[ "$openGl" ] && f_display "openGl" "cmd" "glxinfo"
[ "$alert_3D" ] && text+="**$alert_3D** \n"
# liste providers, preferred, current,
@ -807,24 +816,6 @@ fi_nm(){ # 29/10/2017
unset text
}
fi_vrms(){ # 29/09/2017
local vrms text tempo tempo1 tempo2 pluriel
[ "$(f__cmd_exist vrms)" ] && vrms="$(vrms)"
###
# tempo1=$(grep -o '.*non-free packages' <<< "$vrms" | xargs)
# tempo2=$(grep -o '.*contrib packages' <<< "$vrms" | xargs)
# tempo=$(( ${tempo1:0:1} + ${tempo2:0:1} ))
# [[ "$tempo1" && "$tempo" -gt 1 ]] && pluriel="s" || unset pluriel
if [ "vrms" ]; then
text="## paquets$pluriel non-libres$pluriel \n\n"
f_display "vrms" "cmd" "vrms"
else
text+="* les paquets non-free ou contrib ne peuvent être détectés sans l'installation de vrms \n"
fi
printf "$text\n" >> "$fileOutput"
unset text
}
fi_reseau(){ # 27/10/2017
local slots cards ip_a iwconfig interfaces route resolv canal_wifi ifx alert_wlx text pluriel
# cardsManuel="$(lspci -nnk | grep -EiA 5 'network|ethernet')"
@ -1030,7 +1021,7 @@ fi_system_analyse(){ # 25/10/2017
unset text
}
fi_systeme(){ # 29/10/2017
fi_systeme(){ # 30/10/2017
local mbr description uname bootImage initDaemon xorg shells lastboot uptime charge pluriel text
local alim_total alimentation
[ -d /sys/firmware/efi ] && mbr="EFI" || mbr="Legacy (mbr)"
@ -1066,7 +1057,7 @@ fi_systeme(){ # 29/10/2017
figet_screen
figet_shell
figet_wm
###
###
f__architecture || f__info "Architecture non supportée" "vous pouvez contacter $projet, $contact " \
"pour aider à parfaire le script"
text="## système \n\n"
@ -1074,7 +1065,7 @@ fi_systeme(){ # 29/10/2017
text+="* CPU \n"
text+=" * **$(sed -n '1p' <<< $fget_cpu)** \n"
text+="* GPU \n"
text+="$(sed -E 's/(.*)/ \* \*\*\1\*\*/' <<<$fg_gpu) \n"
[ "$fg_gpu" ] && text+="$(sed -E 's/(.*)/ \* \*\*\1\*\*/' <<<$fg_gpu) \n" || text+="* **n/a** \n"
text+="* boot **$mbr** \n"
text+="* distribution **$fg_distrib** \n\n"
text+='``` \n'
@ -1084,8 +1075,8 @@ fi_systeme(){ # 29/10/2017
text+="$bootImage \n"
text+="démon d'initialisation: $initDaemon \n"
text+="serveur d'affichage: $xorg \n"
text+="nombre d'écrans: $fget_nb_screen \n"
text+="résolution: $fget_resolution \n"
text+="nombre d'écrans: $fg_nb_screen \n"
text+="résolution: $fg_resolution \n"
text+="desktop (DE): $fget_de \n"
text+="window manager: $fget_wm \n"
text+="shell actif: $fget_shell \n"
@ -1116,6 +1107,24 @@ fi_usb(){ # 25/10/2017
unset text
}
fi_vrms(){ # 30/09/2017
local vrms text tempo tempo1 tempo2 pluriel
[ "$(f__cmd_exist vrms)" ] && vrms="$(vrms)"
###
# tempo1=$(grep -o '.*non-free packages' <<< "$vrms" | xargs)
# tempo2=$(grep -o '.*contrib packages' <<< "$vrms" | xargs)
# tempo=$(( ${tempo1:0:1} + ${tempo2:0:1} ))
# [[ "$tempo1" && "$tempo" -gt 1 ]] && pluriel="s" || unset pluriel
if [ "$vrms" ]; then
text="## paquets$pluriel non-libres$pluriel \n\n"
f_display "vrms" "cmd" "vrms"
else
text+="* les paquets non-free ou contrib ne peuvent être détectés sans l'installation de vrms \n"
fi
printf "$text\n" >> "$fileOutput"
unset text
}
# informations batterie(s), assigne $fg_nb_batt $fg_batt
figet_batt(){ #v2 29/10/2017
local batt_detail batt_nb batt_unit batt_capa_design batt_capa_full batt_capa_now batt_conso
@ -1438,7 +1447,8 @@ figet_dmi(){ # 29/10/2017
# assigne $fg_gpu, fg_nb_cpu
figet_gpu(){ # 30/10/2017
local lspci="$(lspci -mm)"
# debug: lspci="$(< tests/lspci)"
[ "$?" -gt 0 ] && return 0
# debug: lspci="$(< tests/lspci)"
fg_gpu="$(gawk -F' "|" "|" -' ' /"Display|"3D|"VGA/ {
sub(/ Corporation/,"",$3); sub(/Advanced Micro Devices, Inc. /,"",$3); sub(/ /," ",$3);
print $3": "$4}' <<< $lspci)"
@ -1692,23 +1702,21 @@ figet_mod_net(){ # thanks wireless-info, assigne $fget_mod_net # 01/10/2017
fget_mod_net="$(lsmod | grep -E "(^|[[:punct:] ])($MODMATCHES|$LSMODMATCHES)[^[:punct:] ]*([[:punct:] ]|$)")"
}
# assigne $fget_nb_screen, $fget_resolution. si $ENV_SSH pas vide, return avec
# fget_resolution=n/a (ssh) & fget_nb_screen=n/a
figet_screen(){ #v2 26/10/2017
local resolution
fget_nb_screen="n/a"
fget_resolution="n/a"
[ "$ENV_SSH" ] && fget_resolution+=" (ssh)"
# assigne $fg_nb_screen, $fg_resolution. return fg_resolution=n/a[ (ssh)] & fg_nb_screen=n/a ou valeurs
figet_screen(){ #v2 30/10/2017
fg_nb_screen="n/a"
fg_resolution="n/a"
[ "$ENV_SSH" ] && fg_resolution+=" (ssh)"
[ "$ENV_SSH" ] && return 0
# xrandr & et xdpyinfo ne retourne pas de nombre écrans correct (multiplex? hybrid?)
if [ $(f__cmd_exist xrandr) ]; then
resolution=$( gawk '/[0-9]\*/ {gsub(/\*\+/,"",$2); printf "%s pixels (%dHz), ", $1, $2}' <<< $( xrandr --query ) )
fg_resolution=$( gawk '/[0-9]\*/ {gsub(/\*\+/,"",$2); printf "%s pixels (%dHz), ", $1, $2}' <<< $( xrandr --query ) )
elif [ $(f__cmd_exist xdpyinfo) ]; then
resolution=$( gawk '/dimensions/ { print $2, $3 ", " }' <<< $(xdpyinfo) )
fg_resolution=$( gawk '/dimensions/ { print $2, $3 ", " }' <<< $(xdpyinfo) )
fi
resolution="${resolution%,*}" # suppression ',*'
fget_resolution="$resolution"
fget_nb_screen=$( grep -o 'pixels' <<< $fget_resolution | grep -c . )
fg_resolution="${fg_resolution%,*}" # suppression ',*'
[ "$(xargs <<< $fg_resolution)" ] || fg_resolution="n/a"
[ "$fg_resolution" != "n/a" ] && fg_nb_screen=$( grep -o 'pixels' <<< $fg_resolution | grep -c . )
}
figet_shell(){ # thanks neofetch, assigne $fget_shell # 04/10/2017
@ -2193,7 +2201,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_graph
fi_log_xorg
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -10,18 +10,18 @@
* finir révision vrms
* ajouter openrc: OpenRC's built-in init is /usr/bin/openrc-init (tester aussi /usr/bin/init-openrc)
The /etc/openrc/
* défaut affichage alpine linux
---
## 2.21.0 30/10/2017
## 2.21.1 30/10/2017
* nouveau: figet_gpu
* suppression: figet_gpu neofetch
* révision: fi_graph, lspci, cmd & affichage cmd selon nb gpu
* fix: alpine linux, figet_screen, figet_gpu, fi_systeme
* fix: fi_vrms
## 2.20.3 29/10/2017