diff --git a/scripts/getInfo b/scripts/getInfo index f0237e0..808a21f 100755 --- a/scripts/getInfo +++ b/scripts/getInfo @@ -1,7 +1,7 @@ #!/bin/bash -version=2.66.4 -date="15/12/2017" +version=2.67.0 +date="16/12/2017" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" script="getInfo" @@ -384,30 +384,6 @@ f_dspl_alrt(){ # 14/12/2017 echo -en "$display" >> "$fileOutput" # flush fonction } - # $1=texte à épurer -f_epure_marque(){ # 14/12/2017 - local text="$1" - - text=${text/System Controller Hub } - text=${text/Advanced Micro Devices, Inc. } - text=${text/Semiconductor Co., Ltd. } - text=${text//Corporation } - text=${text/Series Family /Series } - text=${text/Series Chipset Family /Series } - text=${text/High Definition /HD } - text=${text// Computer} - text=${text// COMPUTER} - text=${text// Limited} - text=${text//, Inc.} - text=${text// Inc.} - text=${text// INC.} - text=${text// Corp.} - text=${text// Co.} - text=${text// Ltd.} - text=${text// Adapter} - echo "$text" -} - # $1=liste fichier(s) à grepper, [$2]: N &| nofile &| novide &| ligneVide &| date &| commentXY &| sources # si aucun fichier dans la liste retour: 'nofile|vide|inexistant' # /!\ protéger les chemins avec " (surtout si plusieurs chemins ou joker) @@ -514,6 +490,42 @@ toDisplay=( echo -e "$STD\n plus d'infos: $GREEN$urlNotice\n$STD" } + # $1=texte à épurer +f_lifting(){ # 16/12/2017 + local text="$1" + + text=${text/ System Controller Hub} + text=${text/ Advanced Micro Devices, Inc.} + text=${text/ Electronics Co., Ltd.} + text=${text/ Co., Ltd.} + text=${text/ Semiconductor Co., Ltd.} + text=${text/ Semiconductor Corp.} + text=${text/ Series Family /Series} + text=${text/ Series Chipset Family /Series} + text=${text/ High Definition /HD} + text=${text/ Semiconductor} + text=${text/ Computer} + text=${text/ COMPUTER} + text=${text/ Industries} + text=${text// Limited} + text=${text//, Inc.} + text=${text//, Inc} + text=${text// Inc.} + text=${text// INC.} + text=${text// Corporation} + text=${text// Corp.} + text=${text// Co.} + text=${text//, Ltd} + text=${text//, Ltd.} + text=${text// Ltd.} + text=${text//\(R\)} + text=${text//\(TM\)} + text=${text//\(r\)} + text=${text//\(tm\)} + text=${text// / } + echo "$text" +} + # f_prnt "1||2|3|l1|l2|l3|tit1|tit2|tit3|hl|quote|flush|code" "texte" '[CONDITION test]' # $1: 1|2|3 indentation, liste à puce, une puce par ligne # l1|l2|l3 ligne, indentation, avec espaces @@ -642,7 +654,7 @@ f_search_ko(){ # 13/12/2017 } # [$1=silent], assigne fe_nb_audio, fe_cards_audio -fi_audio(){ # 14/12/2017 +fi_audio(){ # 16/12/2017 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 @@ -650,6 +662,10 @@ fi_audio(){ # 14/12/2017 x_audio=1 # devices fe_cards_audio=$( figet_lspci "audio" "name" ) + fe_cards_audio=$( f_lifting "$fe_cards_audio" ) + 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" -eq 0 ] && return 0 @@ -984,7 +1000,7 @@ fi_efi(){ # 6/12/2017 } # [$1=silent|xorgOnly], assigne $fe_gpu (liste des gpu), $fe_nb_gpu, fe_Xorg -fi_gpu(){ # 14/12/2017 +fi_gpu(){ # 16/12/2017 local cards cmd_cards prefixCmd openGl pluriel text local stck_glxinfo glx_dvc cmd_glx_dvc stck_glxinfoOpt stck_glxinfoDri glx_dvc_temp local cmd_openGl resolutions cmd_resolutions cmt_resolutions providers cmd_providers @@ -996,6 +1012,9 @@ fi_gpu(){ # 14/12/2017 x_gpu=1 # liste/description gpu et qte fe_gpu=$( figet_lspci "video" "name") + 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" ) # version Xorg Server fe_Xorg=$( xdpyinfoT -display $DISPLAY 2>/dev/null | grep 'version:' ) # version Xorg @@ -1421,14 +1440,15 @@ fi_mem(){ # 5/12/2017 } # [$1=silent], assigne fe_nb_reseau, fe_cards_reseau -fi_net(){ # 14/12/2017 ( matériel ) +fi_net(){ # 16/12/2017 ( matériel ) local cards cmd_cards modEth cmd_modEth cmt_modEth modWln cmd_modWln cmt_modWln pluriel text local alert_wlx x_net=1 # 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 controller} + fe_cards_reseau=${fe_cards_reseau/Network controller: /Network :} + 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 [ "$1" == "silent" ] && return @@ -1907,9 +1927,9 @@ fi_pkg_x(){ #v2 1/12/2017 f_dspl var "$alert_pkg_todo" "aide souhaitée" } -fi_reseau(){ # 11/12/2017 ( configuration ) +fi_reseau(){ # 15/12/2017 ( configuration ) local ip_a interfaces route resolv iwconfig canal_wifi netmgr imgr netmgrinst netmgrrun text pluriel - local ipa slaac='' slaac_mac='' + local ipa slaac='' slaac_mac='' ip4 gw4 ip4_p ip6 gw6 adr_temp slaac slaac_mac local alert_ifconfig alert_slaac # ip a & route @@ -1950,10 +1970,10 @@ fi_reseau(){ # 11/12/2017 ( configuration ) 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 - local ip4 gw4 ip6 gw6 figet_ip "-4" ip4="$fg_ip" gw4="$fg_gws" + ip4_p="$fg_ifn_prior" figet_ip "-6" ip6="$fg_ip" gw6="$fg_gws" @@ -1988,11 +2008,13 @@ fi_reseau(){ # 11/12/2017 ( configuration ) figet_ip "-6" f_prnt l1 "ipv6" f_prnt l2 "$ip6" - f_prnt - [ "$(f__wcv "-w" "$fg_ifn_prior")" -gt 1 ] && pluriel="s" || unset pluriel - f_prnt l2 "interface"$pluriel" sortante"$pluriel": $fg_ifn_prior" '[ "$fg_ifn_prior" ]' f_prnt f_prnt l2 "passerelles: ${gw6//$'\n'/ ⊗ }" + f_prnt + [ "$(f__wcv "-w" "$fg_ifn_prior")" -gt 1 ] && pluriel="s" || unset pluriel + f_prnt l2 "interface"$pluriel" sortante"$pluriel" ipv6: $fg_ifn_prior" '[ "$fg_ifn_prior" ]' + [ "$(f__wcv "-w" "$ip4_p")" -gt 1 ] && pluriel="s" || unset pluriel + f_prnt l2 "interface"$pluriel" sortante"$pluriel" ipv4: $ip4_p" '[ "$ip4_p" ]' f_prnt code f_prnt f_prnt 1 "les adresses Mac peuvent être affichées avec \`$DIRNAME""getInfo --mac\`" @@ -2347,36 +2369,38 @@ fi_touchpad(){ # 14/12/2017 } fi_usb(){ # 15/12/2017 - local lsusb size lsusb_t ls lst ils test result ls_p + local lsusb size lsusb_t ls lst ils motif result ls_p x_usb=1 lsusb=$( lsusb ) [ "$lsusb" ] || return 0 lsusb=$( sort <<< "$lsusb" ) - lsusb=$( f_epure_marque "$lsusb" ) # cosmétique + lsusb=$( f_lifting "$lsusb" ) # cosmétique # largeur max initiale de lsusb size=$(( $( gawk '{ if ( length($0) > size ) size = length($0); } END {print size }' <<< $lsusb ) )) size=$(( $size + 2 )) lsusb_t=$( lsusb -t ) - # formation index bus-device - ls=$( gawk ' - BEGIN {FS=": "} - { + # formation index bus-device de lsub + # ls= 1-1 : Bus 001 Device 001: ID 1d6b:0002: Linux Foundation 2.0 root hub + ls=$( gawk ' BEGIN { FS=": " } + { split($1,tab," ") bus=sprintf("%d",tab[2]) device=sprintf("%d",tab[4]) objet=$2 print bus "-" device " : " $1 " " objet - } - ' <<< $lsusb ) + } ' <<< $lsusb ) ls=$( sed -E 's/(.*)( ID.*)/\1:\2/; s/(.* ID [[:alnum:]]{4}:[[:alnum:]]{4})(.*)/\1:\2/;' <<< $ls ) - # extraction Class Driver et formation index bus-device + # extraction Class Driver de lsusb -t et formation index bus-device + # 1-1 | ⇉ Class: root_hub Driver: ehci-pci/8p lst=$( gawk ' BEGIN {FS=", "} { sub(/^.*Bus /,"",$1) sub(/Human Interface Device/,"HID") - sub(/(Defined at Interface level)/,"indéfini ici") + sub(/\(Defined at Interface level\)/,"Defined Interf") + sub(/Vendor Specific Class/,"Vend. Specific") + sub(/Application Specific Interface/,"App. Specific") split($1,tab,".Port [0-9]+: Dev ") if ( tab[1] ~ /[0-9]+/ ) bus=sprintf("%d",tab[1]); else bus=bus device=tab[2] @@ -2391,56 +2415,27 @@ fi_usb(){ # 15/12/2017 sub(/.*Driver=/,"",$3) driver=$3 } - printf( "%s-%s | ⇉ Class: %-15s Driver: %s\n",bus,device,class,driver ) + printf( "%s-%s | ⇉ Class: %-14s Driver: %s\n",bus,device,class,driver ) } ' <<< $lsusb_t ) # assemblage et suppression index bus-device IFS=$'\n' for ils in $ls; do - test=${ils% :*} - result=$( grep -w -m1 "$test" <<< "$lst" ) - result=${result#* | } - ils=${ils#* : } - ls_p+=$( printf "%-"$size"s %s" $ils $result)$'\n' + motif=${ils% :*} # extraction bus-device + result=$( grep -w -m1 "$motif" <<< "$lst" ) # extraction ligne correspondante dans lst + result=${result#* | } # suppression bus-device + ils=${ils#* : } # suppression bus-device + ls_p+=$( printf "%-"$size"s %s" $ils $result )$'\n' # assemblage done ls_p=${ls_p%[[:cntrl:]]} + # Bus 001 Device 001: ID 1d6b:0002: Linux Foundation 2.0 root hub ⇉ Class: root_hub Driver: ehci-pci/8p IFS="$IFS_INI" - # recherche - detectBluetooth=$( gawk -F ': |⇉ ' ' BEGIN { IGNORECASE=1 } - $5 ~ /Wireless/ && $3 ~ /bluetooth/ { - sub(/[[:blank:]]*Driver/,"",$5); printf "%s %-8s %s\n", $3, $5, $6 - } - ' <<< $ls_p ) - detectWifi=$( gawk -F ': |⇉ ' ' BEGIN { IGNORECASE=1 } - $5 ~ /Wireless/ && $3 ~ /wireless|network/ { - sub(/[[:blank:]]*Driver/,"",$5); printf "%s %-8s %s\n", $3, $5, $6 - } - ' <<< $ls_p ) - detectWebcam=$( gawk -F ': |⇉ ' ' BEGIN { IGNORECASE=1 } - $5 ~ /video/ || $6 ~ /uvcvideo/ { - sub(/[[:blank:]]*Driver/,"",$5); printf "%s %-8s %s\n", $3, $5, $6 - } - ' <<< $ls_p ) - # essai - qBluetooth=$( gawk -F ': |⇉ ' ' BEGIN { IGNORECASE=1 } - $5 ~ /Wireless/ || $3 ~ /bluetooth/ { - sub(/[[:blank:]]*Driver/,"",$5); printf "%s %-8s %s\n", $3, $5, $6 - } - ' <<< $ls_p ) - [ "$detectBluetooth" == "$qBluetooth" ] && unset qBluetooth - qWifi=$( gawk -F ': |⇉ ' ' BEGIN { IGNORECASE=1 } - $5 ~ /Wireless/ || $3 ~ /wireless|network/ { - sub(/[[:blank:]]*Driver/,"",$5); printf "%s %-8s %s\n", $3, $5, $6 - } - ' <<< $ls_p ) - [ "$detectWifi" == "$qWifi" ] && unset qWifi ### f_prnt tit2 "USB" f_dspl cmd "$ls_p" "lsusb" "affichage modifié, ajout Class & Driver" -# f_dspl var "$detectBluetooth" "" "périphérique Bluetooth" -# f_dspl var "$detectWifi" "" "périphérique Wifi" -# f_dspl var "$detectWebcam" "" "périphérique Webcam" -# f_dspl var "$qWifi" "" "suspicion périphérique Wifi" + f_prnt l "$detail" + f_prnt l "$size" + f_prnt flush } fi_vrms(){ # 1/12/2017 @@ -2470,7 +2465,7 @@ fi_vrms(){ # 1/12/2017 } # informations batterie(s), assigne $fg_nb_batt $fg_batt $fg_batt_serial -figet_batt(){ #v2 14/12/2017 +figet_batt(){ #v2 15/12/2017 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 @@ -2573,7 +2568,7 @@ figet_batt(){ #v2 14/12/2017 } # assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu -figet_cpu(){ #v 14/12/2017 +figet_cpu(){ #v 15/12/2017 local cpuinfo speedNom speedMax speedMin speedCpu descrCpu cpu1 cpu2 cpu3 x_cpu=1 @@ -2605,13 +2600,14 @@ figet_cpu(){ #v 14/12/2017 fg_nb_cpu=$( gawk -F ':|@' ' /^physical id/ { if ($2+1 != nbCpu) nbCpu=$2+1 } - END { printf nbCpu} + END { printf "%d",nbCpu } ' <<< "$cpuinfo" ) - fg_nb_cpu=$(( "$fg_nb_cpu" )) # force numérique, utile? # traitement fg_cpu cpu1=$( gawk -v "speedCpu=$speedCpu" -F ':|@' ' - /^model name/ { gsub(/^ | *$|\(R\)|\(TM\)|\(r\)|\(tm\)|CPU/,"",$2); gsub(/ /," ",$2); cpu=$2 } + /^model name/ { + gsub(/^ | $|\(R\)|\(TM\)|\(r\)|\(tm\)|CPU| width/,"",$2); gsub(/ /," ",$2) + cpu=$2 } /^physical id/ { if ($2+1 != nbCpu) nbCpu=$2+1 } /cpu cores/ { procCore=sprintf("%d",$2); if (procCore>1) pllc="s" } /siblings/ { procThread=sprintf("%d",$2); if (procThread>1) pllt="s" } @@ -2647,7 +2643,7 @@ figet_cpu(){ #v 14/12/2017 fg_vendor=$( grep -m1 '^vendor_id' <<< $cpuinfo ) fg_vendor=${fg_vendor#*: } # extraction valeur vendor fg_vendor=${fg_vendor#*: } # extraction valeur vendor - fg_vendor=${fg_vendor//AuthenticAMD/AMD} # allègement + fg_vendor=${fg_vendor//AuthenticAMD/AMD} # allègement fg_vendor=${fg_vendor//GenuineIntel/Intel} # allègement # traitement µarchitecture (( x_cpu_uarch == 1 )) || figet_cpu_uarch @@ -3245,7 +3241,7 @@ figet_dm(){ #v1 14/12/2017 } # informations DMI (firmware partie matériel), $1=[head], assigne $fg_dmi -figet_dmi(){ #v2 14/12/2017 +figet_dmi(){ #v2 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 @@ -3287,10 +3283,13 @@ figet_dmi(){ #v2 14/12/2017 x_dmi=1 # ligne1 $product for idmi in sys_vendor product_name product_version chassis_type; do - tempo=$( cat /sys/class/dmi/id/$idmi 2>/dev/null ) # extraction valeur - tempo=$( sed 's/x.xx*//; s/To be filled by O\.E\.M\.//g' <<< $tempo | xargs ) # ménage + tempo=$( cat /sys/class/dmi/id/$idmi 2>/dev/null ) # extraction valeur + tempo=${tempo/x.x*} # ménage + tempo=${tempo/To be filled by O.E.M.} # ménage + tempo=${tempo/Not Specified} # ménage + tempo=$(xargs <<< $tempo) if [ "$idmi" == "chassis_type" ]; then - tempo="( ${chassis_type[ $(( ${tempo##0} - 1 )) ]} )" # valeur tableau après mise en forme index + tempo=" • "${chassis_type[ $(( ${tempo##0} - 1 )) ]} # valeur tableau après mise en forme index fi # indic1 pour tester égalité avec $board [[ "$idmi" == "sys_vendor" || "$idmi" == "product_name" ]] && indic1+="$tempo " @@ -3319,7 +3318,7 @@ figet_dmi(){ #v2 14/12/2017 [ "$product" ] && fg_dmi="$product "$'\n' [[ "$board" && "$indic1" != "$indic2" ]] && fg_dmi+="$board "$'\n' [ "$bios" ] && fg_dmi+="$bios " - fg_dmi=$( f_epure_marque "$fg_dmi" ) + fg_dmi=$( f_lifting "$fg_dmi" ) unset chassis_type } @@ -3387,7 +3386,7 @@ figet_hw(){ #v2 14/12/2017 } # $1=-4|-6, assigne $fg_ip, $fg_gws6, $fg_ifn, $fg_mac -figet_ip(){ # 14/12/2017 +figet_ip(){ # 15/12/2017 local target ifn x_ip=1 @@ -3422,9 +3421,10 @@ figet_ip(){ # 14/12/2017 # interface sortante if [ "$proto" == "-6" ]; then target=$( gawk '/proto ra / { print $1; exit}' <<< $( ip $proto -o route ) ) - fg_ifn_prior=$( ip $proto route get $target | sed -En 's/.*dev (.*) proto.*src ([0-9a-f:]+).*/\1/p' ) + fg_ifn_prior=$( ip $proto route get $target ) + fg_ifn_prior=$( ip $proto route get $target | sed -En 's/.*dev (.*) proto.*src ([0-9a-f:]+).*/\1 (\2)/p' ) else - fg_ifn_prior=$( ip $proto route get 255.255.255.255 | sed -En 's/.*dev (.*) src ([0-9.]+) .*/\1 \2/p' ) + fg_ifn_prior=$( ip $proto route get 255.255.255.255 | sed -En 's/.*dev (.*) src ([0-9.]+) .*/\1 (\2)/p' ) fi # ifnames & mac fg_ifn="" fg_mac="" @@ -3573,7 +3573,7 @@ figet_lspci(){ # 14/12/2017 lspci=${lspci%(rev *)} display+="$lspci "$'\n' done <<< $( lspci | grep -Ei "$motif" ) - display=$( f_epure_marque "$display" ) + display=$( f_lifting "$display" ) # lspci détaillé RAW || MODULE elif [[ "$2" == "raw" || "$2" == "module" ]]; then slots=$( lspci | grep -Ei "$motif" | cut -d" " -f1 ) @@ -3595,10 +3595,12 @@ figet_lspci(){ # 14/12/2017 done fi fi + # module kernel if [ "$2" == "module" ]; then fg_modules_lp='' [ "$lspci" ] || return 1 + # module utilisé modLspci=$( gawk -F ': ' ' /Kernel modules/ {print $2} @@ -3606,9 +3608,9 @@ figet_lspci(){ # 14/12/2017 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" ) - mod_file=$( f_search_ko "$modLspci" ) if [ "$mod_file" ]; then fg_modules_lp="$fg_modules_lp\n\n$mod_file" diff --git a/scripts/getInfo_changelog.md b/scripts/getInfo_changelog.md index d49c38d..9db9813 100644 --- a/scripts/getInfo_changelog.md +++ b/scripts/getInfo_changelog.md @@ -2,9 +2,17 @@ f__architecture -## getInfo 2.66.4 15/12/2017 +## getInfo 2.67.0 16/12/2017 -* révision: fi_usb, présentation pour parsage ultérieur facile +* révision: affichage interface sortie ipv4 & ipv6 +* révision: f_lifting, motifs suppression +* révision: figet_cpu, figet_dmi, fi_gpu, fi_audio, fi_net, motifs suppression +* fix: figet_cpu, bug ubuntu? non reproductible + +## getInfo 2.66.5 15/12/2017 + +* révision: fi_usb, présentation pour parsage ultérieur +facile +* révison: affichage fi_reseau * fix: mise en page, f_prt ## getInfo 2.66.2 14/12/2017