diff --git a/scripts/getInfo b/scripts/getInfo index caa455a..381694c 100755 --- a/scripts/getInfo +++ b/scripts/getInfo @@ -1,7 +1,7 @@ #!/bin/bash -version=3.13.0 -date="07/02/2018" +version=3.14.0 +date="08/02/2018" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" script="getInfo" @@ -564,7 +564,7 @@ f_lifting(){ # 16/12/2017 text=${text/ Semiconductor Corp.} text=${text/ Series Family /Series} text=${text/ Series Chipset Family /Series} - text=${text/ High Definition /HD} + text=${text/ High Definition / HD } text=${text/ Semiconductor} text=${text/ Computer} text=${text/ COMPUTER} @@ -717,10 +717,12 @@ f_search_ko(){ # 13/12/2017 emplacement=$( du -a "$dir" | grep -Ew "$motif" ) if [ "$emplacement" ]; then IFS=$'\n' - for imod in $emplacement; do - imod=${imod#*$dir} - mod_ko+=" => $imod"$'\n' - done + for imod in $emplacement; do + #~ imod=${imod#*$dir} + imod=${imod#*/} + #~ mod_ko+=" => $imod"$'\n' + mod_ko+=" => /$imod"$'\n' + done IFS="$IFS_INI" mod_ko=${mod_ko%[[:cntrl:]]} # suppression \n final fi @@ -728,27 +730,29 @@ f_search_ko(){ # 13/12/2017 } # [$1=silent], assigne fe_nb_audio, fe_cards_audio -fi_audio(){ # 26/01/2018 +fi_audio(){ # 08/02/2018 local cardsAudio cmd_cards version_alsa card_alsa cmd_card_alsa cmt_card_alsa pluriel text local mod_alsa cmd_mod_alsa cmt_mod_alsa modAudio cmd_modAudio cmt_modAudio local alert_alsa x_audio=1 - fe_nb_audio=0 + # devices - fe_cards_audio=$( figet_lspci "audio" "name" ) - fe_cards_audio=$( f_lifting "$fe_cards_audio" ) + figet_lspci "audio" "name" + fe_cards_audio=$( f_lifting "${lspci[name]}" ) fe_cards_audio=${fe_cards_audio% controller} fe_cards_audio=${fe_cards_audio% Controller} fe_cards_audio=${fe_cards_audio#*: } - fe_nb_audio=$(f__wcv -l "$fe_cards_audio") - [ "$1" == "silent" ] && return 0 # pas d"affichage + fe_nb_audio=${lspci[nb_card]} [ "$fe_nb_audio" -eq 0 ] && return 0 + + [ "$1" == "silent" ] && return 0 # pas d'affichage ### # lspci - cardsAudio=$( figet_lspci "audio" "raw" ) - cmd_cards="lspci -nnv | grep -EiA6 'Audio device|Audio controller'" + figet_lspci "audio" "raw" + cardsAudio=${lspci[card]} + cmd_cards="lspci -nnv | grep -EiA10 'Audio device|Audio controller'" if [ ! -d /proc/asound ] ; then alert_alsa="/proc/asound : répertoire inexistant" alert_alsa="ALSA n'est pas installé correctement" @@ -770,10 +774,10 @@ fi_audio(){ # 26/01/2018 [ "$( f__wcv -l "$mod_alsa" )" -gt 1 ] && pluriel="s" || unset pluriel cmd_mod_alsa="cat /proc/asound/modules" cmt_mod_alsa="module"$pluriel" alsa" - # modules kernel - figet_lspci "audio" "module" &>/dev/null # obtention module utilisé - modAudio="$fg_modules_lp" - cmd_modAudio="lsmod | grep -Ew '$fg_srch_mod_lp'" + # modules kernel utilisé + figet_lspci "audio" "module" + modAudio="${lspci[module]}" + cmd_modAudio="lsmod | grep -Ew '${lspci[srch_mod]}'" [ "$( f__wcv -wv "$modAudio" "^[[:alnum:]]" )" -gt 1 ] && pluriel="s" || unset pluriel cmt_modAudio="$( f__wcv -wv "$modAudio" "^[[:alnum:]]" ) module"$pluriel" utilisé"$pluriel fi @@ -786,7 +790,7 @@ fi_audio(){ # 26/01/2018 f_dspl_alrt "$alert_alsa" "alert" f_dspl cmd "$version_alsa" "/proc/asound/version" "driver alsa (Advanced Linux Sound Architecture)" f_dspl cmd "$card_alsa" "$cmd_card_alsa" "$cmt_card_alsa" - f_dspl cmd "$mod_alsa" "$cmd_card_alsa" "$cmt_card_alsa" + f_dspl cmd "$mod_alsa" "$cmd_mod_alsa" "$cmt_mod_alsa" f_dspl cmd "$modAudio" "$cmd_modAudio" "$cmt_modAudio" } @@ -802,11 +806,11 @@ fi_batt(){ # 14/12/2017 } # [$1=silent], assigne $fe_nb_bluez, $fe_cards_bluez -fi_bluez(){ # 02/02/2018 +fi_bluez(){ # 08/02/2018 local bluez cmd_bluez cmt_bluez mod cmd_mod cmt_mod pluriel text x_bluez=1 - fe_nb_bluez=0 + if hcitool scan &>/dev/null && [[ $( f__which hciconfig ) ]]; then fe_nb_bluez=$( hciconfig name 2>/dev/null ) fe_cards_bluez=$( grep -Eo '^hci[0-9]+' <<< $fe_nb_bluez ) @@ -1085,19 +1089,23 @@ fi_gpu(){ # 07/02/2018 local alert_hybrid alert_3D alert_Wayland x_gpu=1 - fe_nb_gpu=0 + # liste/description gpu et qte - fe_gpu=$( figet_lspci "video" "name") + figet_lspci "video" "name" + fe_gpu=${lspci[name]/VGA compatible controller: } fe_gpu=${fe_gpu/VGA compatible controller: } fe_gpu=${fe_gpu/Display controller: } fe_gpu=${fe_gpu/3D controller: } - fe_nb_gpu=$( f__wcv "-l" "$fe_gpu" ) + fe_nb_gpu=${lspci[nb_card]} + [ "$fe_nb_gpu" -eq 0 ] && return 0 # pas de gpu, rien à voir + # version Xorg Server fe_Xorg=$( xdpyinfo -display $DISPLAY 2>/dev/null | grep 'version:' ) # version Xorg fe_Xorg=${fe_Xorg//*version: /X.Org X Server} - [ "$fe_Xorg" ] || fe_Xorg=$( X -version 2>/dev/null ) # si ver Xorg vide, essai X - [ "$fe_Xorg" ] || fe_Xorg=$( Xorg -version 2>/dev/null ) # si ver Xorg vide, essai Xorg - stck_xrandr=$( xrandr --verbose --auto 2>/dev/null ) + [ "$fe_Xorg" ] || fe_Xorg=$( X -version 2>/dev/null ) # si ver Xorg vide, essai X + [ "$fe_Xorg" ] || fe_Xorg=$( Xorg -version 2>/dev/null ) # si ver Xorg vide, essai Xorg + + stck_xrandr=$( xrandr --verbose 2>/dev/null ) if [ "$wayland" ]; then # avertissements wayland xScreens=$( grep -A1 'Screen' <<< $stck_xrandr ) [ "$( grep 'XWAYLAND' <<< $xScreens )" ] && wayland+=" Xwayland" @@ -1105,8 +1113,8 @@ fi_gpu(){ # 07/02/2018 fi [ "$1" == "silent" ] && return 0 - [ "$fe_nb_gpu" -eq 0 ] && return 0 # pas de gpu, rien à voir -### ## xorgOnly + +### ## xorgOnly (essai) toScrut=( '/etc/X11/xorg.conf ' '/etc/X11/xorg.conf.d/*.conf' @@ -1124,36 +1132,31 @@ fi_gpu(){ # 07/02/2018 if [ "$1" == "xorgOnly" ]; then f_dspl cmd "$confs" "$cmd_confs" "$cmt_confs" confs=$( f_grep_file "/usr/share/X11/xorg.conf.d/*" ) - f_dspl cmd "$confs" "grep -Ersv '^#|^$' /usr/share/X11/xorg.conf.d/*" "config par défaut Xorg" + f_dspl cmd "$confs" "grep -Ersv '^#|^$' /usr/share/X11/xorg.conf.d/*" "config par défaut Xorg" fi_log_xorg "notitre" return 0 fi ### - + xrandr --auto 2>/dev/null # lspci # lspci -nnk | grep -EiA 3 'vga|display|3d' # lspci -nnv | grep -iEA10 'vga|display|3d' # lspci -nnv -s $( lspci | grep -Ei 'vga|display|3d' | cut -d" " -f1 ) # lspci -nnv -s $( awk '/VGA |Display |3D / {print $1}' <<< $( lspci ) ) - cmd_cards="lspci -nnv -s $( $c_awk '/VGA |Display |3D / {print $1}' <<< $( lspci ) )" - if [ "$fe_nb_gpu" -eq 1 ]; then # une seule carte - cards=$( figet_lspci "video" "raw" ) - else # plusieurs cartes, essai optirun ou prime - cards=$( figet_lspci "video" "raw" "graph") - prefixCmd=$(basename $(which toto) 2>/dev/null) || prefixCmd="DRI_PRIME=1" - cmd_cards="$prefixCmd $cmd_cards" - fi + + figet_lspci "video" "raw" + cards=${lspci[card]} + cmd_cards="${lspci[prefix_gpu]}lspci -nnv -s \$( lspci | awk '/VGA |Display |3D / {print \$1}' )" if grep -iq 'Unknown header type 7f' <<< "$cards" ; then alert_hybrid="Une carte graphique semble désactivée actuellement, lspci n'est pas complet. \n" - alert_hybrid+="Voir DRI_PRIME, vga-switcheroo, Bumbledee...?" fi + # openGl / glxinfo if [[ "$wayland" && "$EUID" -eq 0 ]]; then # évite erreur $DISPLAY en root wayland openGl="n/a:wayland root" resolutions="n/a:wayland root" providers="n/a:wayland root" current_preferred="n/a:wayland root" else - # openGl / glxinfo if [ $( f__which glxinfo ) ]; then stck_glxinfo=$( glxinfo ) # test 3D actif @@ -1195,22 +1198,23 @@ fi_gpu(){ # 07/02/2018 fi # xrandr: résolutionS & providers & preferred/current if [ $( f__which xrandr ) ]; then - stck_xrandr_query=$( xrandr --query --auto ) - resolutions=$( grep -i 'screen' <<< $stck_xrandr_query )$'\n' # partie carte graphique - resolutions+=$( grep -A10 -iw 'connected' <<< $stck_xrandr_query ) # partie connexions + stck_xrandr_query=$( xrandr --query 2>/dev/null ) + resolutions=$( grep -i 'screen' <<< $stck_xrandr_query )$'\n' # screen partie "carte graphique" + resolutions+=$( grep -A10 -iw 'connected' <<< $stck_xrandr_query ) # partie "output" cmd_resolutions="xrandr --query | grep -A10 -B1 -i 'screen'" cmt_resolutions="10 premières résolutions possibles" - providers=$( xrandr --auto --listproviders ) # DRI: ok, sort 2 fournisseurs + providers=$( xrandr --listproviders 2>/dev/null ) # DRI: ok, sort 2 fournisseurs cmd_providers="xrandr --listproviders" current_preferred=$( grep -EA2 'current|preferred' <<< $stck_xrandr ) cmd_current_preferred="xrandr --verbose | grep -EA2 'current|preferred'" cmt_current_preferred="résolution courante et préférée" fi fi - # modules - figet_lspci "video" "module" &>/dev/null # obtention module utilisé - modGpu="$fg_modules_lp" - cmd_modGpu="lsmod | grep -Ew '$fg_srch_mod_lp'" + + # modules utilisé + figet_lspci "video" "module" + modGpu="${lspci[module]}" + cmd_modGpu="lsmod | grep -Ew '${lspci[srch_mod]}'" [ "$( f__wcv -wv "$modGpu" "^[[:alnum:]]" )" -gt 1 ] && pluriel="s" || unset pluriel cmt_modGpu="**Gpu:** $( f__wcv -wv "$modGpu" "^[[:alnum:]]" ) module"$pluriel" utilisé"$pluriel # fonctions externes @@ -1283,7 +1287,7 @@ fi_hw(){ # 14/12/2017 } # $1=-4|-6|-46 protocole -fi_ip_pub(){ #v 14/12/2017 +fi_ip_pub(){ # 14/12/2017 local itest option="$1" option=${option//46/4 6} @@ -1519,39 +1523,40 @@ fi_mem(){ # 5/12/2017 } # [$1=silent], assigne fe_nb_reseau, fe_cards_reseau -fi_net(){ # 18/12/2017 ( matériel ) +fi_net(){ # 08/02/2018 ( matériel ) local cards cmd_cards modEth cmd_modEth cmt_modEth modWln cmd_modWln cmt_modWln pluriel text local alert_wlx x_net=1 - fe_nb_reseau=0 + # devices - fe_cards_reseau=$( figet_lspci "net" "name" ) # noms des cartes réseau détectées, mix ethernet/wifi - fe_cards_reseau=${fe_cards_reseau/Network controller: /Network :} - fe_cards_reseau=${fe_cards_reseau/Ethernet controller: /Ethernet:} + figet_lspci "net" "name" # noms des cartes réseau détectées, mix ethernet/wifi + fe_cards_reseau=${lspci[name]/Network controller: /Wireless: } + fe_cards_reseau=${fe_cards_reseau/Ethernet controller: /Ethernet: } fe_cards_reseau=${fe_cards_reseau/Wireless Network/Wireless} - fe_nb_reseau=$(f__wcv -l "$fe_cards_reseau") # nombre de cartes réseau détectées, mix ethernet/wifi + fe_nb_reseau=${lspci[nb_card]} # nombre de cartes réseau détectées, mix ethernet/wifi [ "$1" == "silent" ] && return [ "$fe_nb_reseau" -eq 0 ] && return 0 # pas de cartes réseau, rien à voir (en attendant usb ou autre) ### # lspci - cards=$( figet_lspci "net" "raw" ) - cmd_cards="lspci -nnv | grep -EiA 15 'network|ethernet'" # lspci -nnk | grep -EiA 3 'network|ethernet' # lspci -nnv -s $( lspci | grep -Ei 'network' | cut -d" " -f1 ) # lspci -nnv -s $( lspci | grep -Ei 'ethernet' | cut -d" " -f1 ) + figet_lspci "net" "raw" + cards=${lspci[card]} + cmd_cards="lspci -nnv | grep -EiA 10 'network|ethernet'" #modules ethernet - figet_lspci "ethernet" "module" &>/dev/null # obtention module utilisé - modEth="$fg_modules_lp" - cmd_modEth="lsmod | grep -Ew '$fg_srch_mod_lp'" + figet_lspci "ethernet" "module" # obtention module utilisé + modEth="${lspci[module]}" + cmd_modEth="lsmod | grep -Ew '${lspci[srch_mod]}'" [ "$( f__wcv -wv "$modEth" "^[[:alnum:]]" )" -gt 1 ] && pluriel="s" || unset pluriel cmt_modEth="**Ethernet:** $( f__wcv -wv "$modEth" "^[[:alnum:]]" ) module"$pluriel" utilisé"$pluriel # modules wifi - figet_lspci "wireless" "module" &>/dev/null # obtention module utilisé - modWln="$fg_modules_lp" - cmd_modWln="lsmod | grep -Ew '$fg_srch_mod_lp'" + figet_lspci "wireless" "module" # obtention module utilisé + modWln="${lspci[module]}" + cmd_modWln="lsmod | grep -Ew '${lspci[srch_mod]}'" [ "$( f__wcv -wv "$modWln" "^[[:alnum:]]" )" -gt 1 ] && pluriel="s" || unset pluriel cmt_modWln="**Wifi:** $( f__wcv -wv "$modWln" "^[[:alnum:]]" ) module"$pluriel" utilisé"$pluriel (( x_ip == 1 )) || figet_ip @@ -1596,7 +1601,7 @@ fi_nm(){ # 26/01/2018 f_dspl cmd "$nm_wifis" "$cmd_nm_wifis" "$cmt_nm_wifis" } -fi_packagers(){ #v2 23/11/2017 +fi_packagers(){ # 23/11/2017 local alert_pkg_todo="ce gestionnaire de paquets n'est pas maîtrisé par manque d'expertise \n" alert_pkg_todo+="vous êtes donc bienvenus à contribuer dans ce domaine: \n" alert_pkg_todo+="https://framagit.org/kyodev/kyopages/blob/master/scripts/CONTRIB.md#getinfo" @@ -1641,7 +1646,7 @@ fi_packagers(){ #v2 23/11/2017 fi } -fi_pkg_apt(){ #v3 02/02/2018 +fi_pkg_apt(){ # 02/02/2018 local dateMaj nb_packages ifile info_update text pluriel local sources cmt_sources cmd_sources result local apt_v apt_version apt_prefs cmt_apt_prefs cmd_apt_prefs alert_non_pref @@ -1930,7 +1935,7 @@ fi_pkg_apt(){ #v3 02/02/2018 f_dspl cmd "$kernel" "$cmd_kernel" "$cmt_kernel" } -fi_pkg_x(){ #v2 1/12/2017 +fi_pkg_x(){ # 1/12/2017 local nb_packages cmd_nbPackages sources cmd_sources holded cmd_holded if [[ ${1%:*} == "dnf" ]]; then # Fedora, RedHat (rpm) @@ -2129,7 +2134,7 @@ fi_reseau(){ # 15/12/2017 ( configuration ) f_dspl_alrt "$alert_slaac" "info" } -fi_serial(){ #v9 1/12/2017 +fi_serial(){ # 1/12/2017 local chassis_serial machineId text (( x_disk == 1 )) || figet_disk @@ -2154,7 +2159,7 @@ fi_serial(){ #v9 1/12/2017 echo -e "$text\n" } -fi_ssid(){ #v2 24/12/2017 +fi_ssid(){ # 24/12/2017 local nm_ssid text local file_output="/tmp/$RANDOM-$RANDOM" # ré-assigne sortie pour f_dspl @@ -2177,7 +2182,7 @@ fi_ssid(){ #v2 24/12/2017 rm "$file_output" } -fi_system(){ # 26/01/2018 +fi_system(){ # 08/02/2018 local mbr uname bootImage initDaemon date_install lastboot uptime uptimePure loadAverage pluriel text local enum_batt serverX local alimentation alim_total @@ -2323,7 +2328,8 @@ fi_system(){ # 26/01/2018 f_prnt l2 "$fg_nb_batt batterie"$pluriel" présente"$pluriel":" '[ "$fg_batt" ]' f_prnt l3 "$enum_batt" '[ "$fg_batt" ]' [ "$fe_nb_touchpad" -gt "1" ] && pluriel="s" || unset pluriel - f_prnt l2 "$fe_nb_touchpad pavé"$pluriel" tactile"$pluriel": $fe_touchpad" '[ "fe_touchpad" ]' + f_prnt l2 "$fe_nb_touchpad pavé"$pluriel" tactile"$pluriel":" '[ "fe_touchpad" ]' + f_prnt l3 "$fe_touchpad" '[ "fe_touchpad" ]' f_prnt code f_prnt f_prnt 1 "$( sed -E 's/^(.*: )(.*)/\1**\2**/' <<<$fg_disk_part_fix_tot )" '[ "$fg_disk_part_fix_tot" ]' @@ -2333,7 +2339,7 @@ fi_system(){ # 26/01/2018 f_prnt flush } -fi_system_analyse(){ #v 26/01/2018 +fi_system_analyse(){ # 26/01/2018 [ $( f__which systemd ) ] || return 0 # pas systemd local bootTime cmd_bootTime cmt_bootTime pluriel text local srvcFail cmd_srvcFail cmt_srvcFail qte_srvcFail isrvc srvcFail_list info_services @@ -2407,15 +2413,20 @@ fi_system_analyse(){ #v 26/01/2018 } # [$1=silent], assigne $fe_touchpad, fe_nb_touchpad -fi_touchpad(){ # 26/01/2018 +fi_touchpad(){ # 08/02/2018 local device cmd_device toScrut xfile file_logs type type_pt pilote cmd_pilote cmt_pilote info_driver x_touchpad=1 - fe_nb_touchpad=0 + device=$( grep -Ei -B1 -A8 'synaptics|alps|etps|elan' /proc/bus/input/devices ) || return 0 - fe_touchpad=$( grep -i 'Name=' <<< $device ) - fe_touchpad=${fe_touchpad#*Name=\"} # suppression début - fe_touchpad=${fe_touchpad%\"} # suppression fin + device=$( grep -i 'Name=' <<< $device ) + unset fe_touchpad + while read -r; do + REPLY=${REPLY#*Name=\"} # suppression début + REPLY=${REPLY%\"} # suppression fin + fe_touchpad+="$REPLY "$'\n' + done <<< "$device" + fe_touchpad=${fe_touchpad%$'\n'} # suppression \n final cmd_device="grep -Ei -B1 -A8 'synaptics|alps|etps|elan' /proc/bus/input/devices" # recherche Xorg.log toScrut=( @@ -2437,11 +2448,10 @@ fi_touchpad(){ # 26/01/2018 type_pt=${type_pt/23/ 2\/3} fe_touchpad+="$type_pt" fi - fe_nb_touchpad=$( grep -ci 'touchpad' <<< "$fe_touchpad" ) + #~ fe_nb_touchpad=$( grep -ci 'touchpad' <<< "$fe_touchpad" ) + fe_nb_touchpad=$( f__wcv -l "$fe_touchpad" ) [[ "$1" == "silent" ]] && return 0 - ### - if [ "$ENV_DEBIAN" ]; then pilote=$( $c_awk ' /^ii/ { printf "%-30s", $2; $1=$2=$3=$4=""; print $0 } @@ -2455,8 +2465,6 @@ fi_touchpad(){ # 26/01/2018 ### f_prnt 1 "$( sed -E 's/(.*)/**\1** /' <<< $fe_touchpad )" # mise en gras f_prnt - f_prnt tit2 "Touchpad" - f_dspl cmd "$device" "$cmd_device" f_dspl cmd "$pilote" "$cmd_pilote" "$cmt_pilote" f_dspl_alrt "$info_driver" "info" } @@ -2533,7 +2541,6 @@ fi_usb(){ # 26/01/2018 ### f_prnt tit2 "USB" f_dspl cmd "$ls_p" "lsusb + lsusb -t" "affichage modifié, ajout Class & Driver" - f_prnt flush } fi_vrms(){ # 1/12/2017 @@ -2563,7 +2570,7 @@ fi_vrms(){ # 1/12/2017 } # informations batterie(s), assigne $fg_nb_batt $fg_batt $fg_batt_serial -figet_batt(){ #v2 26/01/2018 +figet_batt(){ # 26/01/2018 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_sante batt_restant tempo batRep ibat uevent @@ -2666,7 +2673,7 @@ figet_batt(){ #v2 26/01/2018 } # assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu -figet_cpu(){ #v 26/01/2018 +figet_cpu(){ # 26/01/2018 local cpuinfo speedNom speedMax speedMin speedCpu descrCpu cpu1 cpu2 cpu3 x_cpu=1 @@ -3143,7 +3150,7 @@ figet_cpu_uarch(){ # 14/11/2017 } # assigne $fg_de, $fg_de_panel -figet_de(){ #v 04/02/2018 # thanks neofetch +figet_de(){ # 04/02/2018 # thanks neofetch local de="n/a" ps x_de=1 @@ -3194,7 +3201,7 @@ figet_de(){ #v 04/02/2018 # thanks neofetch # $fg_disk_part_fixe_m, $fg_disk_part_amov_m : liste partitions montées, fixes ou amovibles # $fg_disk_part_swap : liste partitions swap # $fg_disk_part_fixe_nm, $fg_disk_part_amov_nm : liste partitions non montées, fixes ou amovibles -figet_disk(){ #v2 26/01/2018 +figet_disk(){ # 26/01/2018 local size type list_id idisk lsblk vendor model rev serial unset fg_disk_fixe fg_disk_amov @@ -3268,7 +3275,7 @@ figet_disk(){ #v2 26/01/2018 } # assigne $fg_distrib -figet_distrib(){ #v 14/12/2017 +figet_distrib(){ # 14/12/2017 local prefix version x_distrib=1 @@ -3307,7 +3314,7 @@ figet_distrib(){ #v 14/12/2017 } # display manager, assigne $fg_dm (liste) ou 'n/a', $fg_dm_actif -figet_dm(){ #v1 18/12/2017 +figet_dm(){ # 18/12/2017 local dm_list="cdm entranced gdm3 gdm qingy kdm ldm lightdm lxdm mdm nodm orthos sddm slim wdm xdm" local idm ps systemctl x11 @@ -3347,7 +3354,7 @@ figet_dm(){ #v1 18/12/2017 } # informations DMI (firmware partie matériel), $1=[head], assigne $fg_dmi -figet_dmi(){ #v2 16/12/2017 +figet_dmi(){ # 16/12/2017 local product board bios tempo idmi indic1="" indic2="" local chassis_type=( # type de chassis selon smbios janvier 2017 # http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf @@ -3429,7 +3436,7 @@ figet_dmi(){ #v2 16/12/2017 } # infos température et fan via acpi, assigne $fg_hw -figet_hw(){ #v2 26/01/2018 +figet_hw(){ # 26/01/2018 local name labelF inputF labelT inputT critT hystT maxiT fan temp ihw x_hw=1 @@ -3545,7 +3552,7 @@ figet_ip(){ # 25/01/2018 } # $1=-4|-6, assigne $fg_ip_pub -figet_ip_pub(){ #v 24/12/2017 +figet_ip_pub(){ # 24/12/2017 local dig_test ip_test iip list_ip4(){ # testé 11/12/2017 @@ -3655,13 +3662,13 @@ figet_ip_pub(){ #v 24/12/2017 fi } - # $1=audio|video|net & audio|ethernet|wireless, $2 objet raw|name|module, $3=[graph] (optirun, DRI), - # affiche device (name), lspci détail (raw) - # pour module (module kernel), video|ethernet|wireless, assigne $fg_modules_lp $fg_srch_mod_lp -figet_lspci(){ # 26/01/2018 - local motif slots lspci display='' prefixCmd modLspci mod_file + # $1=audio|video|net|ethernet|wireless, $2 objet raw|name|module REQUIS: declare -A lspci + # $2=name: device(s) (name) -> assigne ${lspci[name]} ${lspci[nb_card]} + # $2=raw: détail lspci (-nnv) -> assigne ${lspci[card]} ${lspci[prefix_gpu]} + # $2=module: (module kernel) -> assigne ${lspci[module]} ${lspci[srch_mod]} +figet_lspci(){ # 08/02/2018 + local motif field1 pci slots nb_slots pci modLspci mod_file - x_lspci=1 if [ "$1" = "audio" ]; then motif="Audio device|Audio controller|Multimedia audio controller" elif [ "$1" = "video" ]; then @@ -3673,59 +3680,66 @@ figet_lspci(){ # 26/01/2018 elif [ "$1" = "wireless" ]; then motif="Network controller" fi - # uniquement les devices + # les devices if [ "$2" == "name" ]; then - while read -r field1 lspci; do - lspci=${lspci%(rev *)} - display+="$lspci "$'\n' + unset lspci[name] + while read -r field1 pci; do + pci=${pci%(rev *)} + lspci[name]+="$pci "$'\n' done <<< $( lspci | grep -Ei "$motif" ) - display=$( f_lifting "$display" ) - # lspci détaillé RAW || MODULE - elif [[ "$2" == "raw" || "$2" == "module" ]]; then + lspci[name]=$( f_lifting "${lspci[name]}" ) + lspci[name]=${lspci[name]%[[:cntrl:]]} # suppression \n final + lspci[nb_card]=$( grep -cEv '^[[:space:]]*$' <<< "${lspci[name]}" ) + return 0 + fi + + # lspci détaillé RAW (servira à MODULE pour extraire les drivers utilisés) + if [[ "$2" == "raw" || "$2" == "module" ]]; then + unset lspci[card] slots=$( lspci | grep -Ei "$motif" | cut -d" " -f1 ) if ! lspci -nnv &>/dev/null ; then # commande/option indisponible display="lspci -nnv -s non disponible" return 1 - else - for lspci in $slots; do - if [[ "$3" == "graph" && "$( f__which optirun )" ]]; then - lspci=$( optirun lspci -nnv -s $lspci ) - elif [ "$3" == "graph" ]; then - lspci=$( DRI_PRIME=1 lspci -nnv -s $lspci ) - else - lspci=$( lspci -nnv -s $lspci ) # normalement inutile, le contexte DRI_PRIME pourrait marcher partout - fi - lspci=${lspci/(prog-if*])} # suppression (prog-if...]) - lspci=${lspci/Capabilities: [[:cntrl:]][[:blank:]]} # suppression Capabilities: (user) - display+="$lspci"$'\n\n' # double \n pour espace entre card - done fi + nb_slots=$( grep -cEv '^[[:space:]]*$' <<< "$slots" ) + for pci in $slots; do + if [[ "$1" == "video" && "$nb_slots" -gt 1 ]]; then # multi-cartes graphiques + if [ $( f__which optirun ) ]; then + pci=$( optirun lspci -nnv -s $pci ) + lspci[prefix_gpu]="optirun " + else + pci=$( DRI_PRIME=1 lspci -nnv -s $pci ) + lspci[prefix_gpu]="DRI_PRIME=1 " + fi + else + pci=$( lspci -nnv -s $pci ) + fi + pci=${pci/(prog-if*])} # suppression (prog-if...]) + pci=${pci/Capabilities: [[:cntrl:]][[:blank:]]} # suppression Capabilities: (user) + lspci[card]+="$pci"$'\n\n' # double \n pour espace entre card + done + lspci[card]=${lspci[card]%$'\n'$'\n'} # suppression double \n final fi # module kernel if [ "$2" == "module" ]; then - fg_modules_lp='' - [ "$lspci" ] || return 1 + [ ${lspci[nb_card]} -lt 1 ] && return # pas de cards, sortie # module utilisé modLspci=$( $c_awk -F ': ' ' /Kernel modules/ {print $2} - ' <<< $lspci ) + ' <<< "${lspci[card]}" ) modLspci=${modLspci// /|} # si jamais plusieurs modules ??.. modLspci=${modLspci%|} # si | final modLspci=${modLspci#|} # si | au début - # modules et emplacement - fg_modules_lp=$( lsmod | grep -Ew "$modLspci" ) + lspci[module]=$( lsmod | grep -Ew "$modLspci" ) mod_file=$( f_search_ko "$modLspci" ) if [ "$mod_file" ]; then - fg_modules_lp="$fg_modules_lp\n\n$mod_file" + lspci[module]="${lspci[module]}\n\n$mod_file" fi - fg_srch_mod_lp="$modLspci" - return + lspci[srch_mod]="$modLspci" fi - display=${display%[[:cntrl:]]} # suppression \n final - echo -en "$display\n" } # $1=mem|swap [total|notitle|nocoltitle], assigne $fg_mem ($2=debug all cols + free) @@ -3837,7 +3851,7 @@ figet_modules(){ # 26/01/2018 } # assigne $fg_nb_screen, $fg_resolution. return fg_resolution=n/a[ (ssh)] & fg_nb_screen=n/a ou valeurs -figet_screen(){ #v2 07/02/2018 +figet_screen(){ # 07/02/2018 x_screen=1 fg_nb_screen=0 @@ -3853,8 +3867,6 @@ figet_screen(){ #v2 07/02/2018 # résolution if [ $( f__which xrandr ) ]; then fg_resolution=$( $c_awk '/[0-9]\*/ {gsub(/\*\+/,"",$2); printf "%s pixels (%dHz), ", $1, $2}' <<< $( xrandr --query ) ) - elif [ $( f__which xdpyinfo ) ]; then # fallback (pas fiable si multi-écran?) - fg_resolution=$( $c_awk '/dimensions/ { print $2, $3 ", " }' <<< $(xdpyinfo) ) fi fg_resolution=${fg_resolution%,*} # suppression ',*' final @@ -3868,7 +3880,7 @@ figet_screen(){ #v2 07/02/2018 } # assigne $fg_shell, $fg_shells -figet_shell(){ #v2 14/12/2017 # thanks neofetch +figet_shell(){ # 14/12/2017 # thanks neofetch local shell ish x_shell=1 @@ -3953,7 +3965,7 @@ figet_ucode(){ # 14/12/2017 } # assigne $fg_wm (compositor, pas en variable publique, pas fiabilisé) -figet_wm(){ #v 14/12/2017 base départ neofetch +figet_wm(){ # 14/12/2017 base départ neofetch local id wm_brut compositor x_wm=1 @@ -4286,7 +4298,7 @@ elif type -p "$c_awk" &>/dev/null; then fi # détection rapide systeme deb -type -p "dpkg" &>/dev/null && ENV_DEBIAN="oui" + type -p "dpkg" &>/dev/null && ENV_DEBIAN="oui" # définition couleurs f__color @@ -4390,6 +4402,7 @@ pasteDuration=7 # durée de conservation standard du paste en jours spc5=$'\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0' ligneRapport="Rapport du $(date '+%d/%m/%Y %H:%M %z')$spc5◇$spc5$0 $*$spc5◇$spc5[$script $version]($url_notice)" +declare -A lspci # sortie figet_lspci options=$@ @@ -4434,7 +4447,8 @@ for j in $options; do # deuxième passe options, actions # fi_touchpad # à fixer sur x230 # fi_bluez # long # fi_packagers - fi_gpu + #~ fi_gpu + fi_audio echo; f_prnt_md "$file_output" ;; # test -c* | all ) diff --git a/scripts/getInfo_changelog.md b/scripts/getInfo_changelog.md index 91cc47f..5131eeb 100644 --- a/scripts/getInfo_changelog.md +++ b/scripts/getInfo_changelog.md @@ -2,14 +2,20 @@ * mawk en cours de test +## getInfo 3.14.0 08/02/2018 + +révision: fi_gpu, fi_audio, fi_net (mod figet_lspci) +fix: fi_gpu, affichage cmd lspci -nnv +fix: fi_touchpad, affichage matériel +fix: fi_system, affichage touchpad si > 1 +fix: figet_lspci si optirun, révision + ## getInfo 3.13.0 07/02/2018 -fix: fi_gpu, affichage version serveur xorg -fix: figet_screen, résolution avec xdpyinfo quand plusieurs écrans, priorité à xrandr - -## getInfo 3.12.1 02/02/2018 - +révision: fi_gpu révision: général, pas de string vide pour gettext +fix: fi_gpu, affichage version serveur xorg & lancement optirun +fix: figet_screen, résolution avec xdpyinfo quand plusieurs écrans, priorité à xrandr ## getInfo 3.12.0 01/02/2018