getInfo 2.21.1

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

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.21.0
version=2.21.1
date="30/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -302,10 +302,11 @@ 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**
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)"
@ -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,14 +594,14 @@ 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"
@ -1066,7 +1075,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 +1083,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 +1093,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"
@ -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

View File

@ -10,17 +10,17 @@
* 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
## 2.20.3 29/10/2017