mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 00:47:47 +00:00
Corrected misnamed cpu/normal ban lists, no longer calling working lists A_...
This commit is contained in:
parent
3873d50e86
commit
c2f692c068
35
inxi
35
inxi
|
@ -39,6 +39,20 @@
|
|||
#### VARIABLES
|
||||
########################################################################
|
||||
|
||||
GAWK_CLEANUP='
|
||||
gsub(/,/," ",$NF)
|
||||
gsub(/[^ | $| \t]+/," ",$NF)
|
||||
'
|
||||
|
||||
# fred=$( echo ' corporate graphics crap of some type ' | gawk '
|
||||
# /graphics/ {
|
||||
# gsub(/"graphics"/, "", $NF )
|
||||
# '
|
||||
# $GAWK_CLEANUP
|
||||
# '}' )
|
||||
# echo $fred;exit
|
||||
|
||||
|
||||
## NOTE: we can use hwinfo if it's available in all systems, or most, to get
|
||||
## a lot more data and verbosity levels going
|
||||
|
||||
|
@ -171,6 +185,8 @@ DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-versio
|
|||
# 00000000 01 01 6f 6e 65 20 74 77 6f 0a |..one two.|
|
||||
A_NORMAL_BANS=( corporation communications gmbh technologies technology group $'\2'"\<ltd\>" ltd. $'\2'"\<inc\>" inc. $'\2'\<co\> co. "(tm)" "(r)" $'\2'"\(rev ..\)" )
|
||||
A_CPU_BANS=( @ cpu deca 'dual core' 'tri core' 'quad core' ennea genuine hepta hexa multi octa penta 'processor' processor single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" )
|
||||
BAN_LIST_NORMAL=''
|
||||
BAN_LIST_CPU=''
|
||||
|
||||
### Source global config overrides
|
||||
if [[ -s /etc/$SCRIPT_NAME.conf ]];then
|
||||
|
@ -310,7 +326,7 @@ remove_erroneous_chars()
|
|||
}
|
||||
|
||||
# Enforce boilerplate and buzzword filters
|
||||
# args: $1 - A_NORMAL_BANS/A_CPU_BANS; $2 - string to sanitize
|
||||
# args: $1 - BAN_LIST_NORMAL/BAN_LIST_CPU; $2 - string to sanitize
|
||||
sanitize_characters()
|
||||
{
|
||||
# Cannot use strong quotes to unquote a string with pipes in it!
|
||||
|
@ -380,6 +396,7 @@ make_ban_lists()
|
|||
echo "$ban_list"
|
||||
}
|
||||
# make_ban_lists "${A_CPU_BANS[@]}";exit
|
||||
|
||||
# Set the colorscheme
|
||||
# args: $1 = <scheme number>|<"none">
|
||||
set_color_scheme()
|
||||
|
@ -767,9 +784,9 @@ set_calculated_variables()
|
|||
##/bin/sh -c 'echo "PATH in subshell=\"$PATH\""'
|
||||
|
||||
# Do this after sourcing of config overrides so user can customize banwords
|
||||
A_NORMAL_BANS=$( make_ban_lists "${A_NORMAL_BANS[@]}" ) # Contrary to my previous belief, "${ARR[@]}" passes a quoted list, not one string
|
||||
A_CPU_BANS=$( make_ban_lists "${A_CPU_BANS[@]}" )
|
||||
##echo "A_NORMAL_BANS='$A_NORMAL_BANS'"
|
||||
BAN_LIST_NORMAL=$( make_ban_lists "${A_NORMAL_BANS[@]}" ) # Contrary to my previous belief, "${ARR[@]}" passes a quoted list, not one string
|
||||
BAN_LIST_CPU=$( make_ban_lists "${A_CPU_BANS[@]}" )
|
||||
##echo "BAN_LIST_NORMAL='$BAN_LIST_NORMAL'"
|
||||
}
|
||||
|
||||
#### -------------------------------------------------------------------
|
||||
|
@ -784,7 +801,7 @@ get_audio_data()
|
|||
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F': ' '
|
||||
{ IGNORECASE=1 }
|
||||
/multimedia audio controller|audio device/ {
|
||||
gsub(/'"$A_NORMAL_BANS"'/, "", $NF )
|
||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
||||
print $NF
|
||||
}' ) )
|
||||
IFS="$ORIGINAL_IFS"
|
||||
|
@ -844,8 +861,8 @@ get_cpu_data()
|
|||
|
||||
/^model name|^cpu\t+:/ {
|
||||
gsub(/,/," ",$NF)
|
||||
gsub(/'"$A_NORMAL_BANS"'/, "", $NF )
|
||||
gsub(/'"$A_CPU_BANS"'/, "", $NF )
|
||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
||||
gsub(/'"$BAN_LIST_CPU"'/, "", $NF )
|
||||
gsub(/[ \t]+/," ",$NF)
|
||||
cpu[nr, "model"] = $NF
|
||||
}
|
||||
|
@ -970,7 +987,7 @@ get_graphics_card_data()
|
|||
IFS="$ORIGINAL_IFS"
|
||||
for (( i=0; i < ${#A_GFX_CARD_DATA[@]}; i++ ))
|
||||
do
|
||||
A_GFX_CARD_DATA[i]=$( sanitize_characters A_NORMAL_BANS "${A_GFX_CARD_DATA[i]}" )
|
||||
A_GFX_CARD_DATA[i]=$( sanitize_characters BAN_LIST_NORMAL "${A_GFX_CARD_DATA[i]}" )
|
||||
done
|
||||
# handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes..
|
||||
if [[ ${#A_GFX_CARD_DATA[@]} -eq 0 ]];then
|
||||
|
@ -1231,7 +1248,7 @@ get_networking_data()
|
|||
gsub(/realtek semiconductor/, "Realtek", nic)
|
||||
gsub(/davicom semiconductor/, "Davicom", nic)
|
||||
gsub(/,/," ", nic)
|
||||
gsub(/'"$A_NORMAL_BANS"'/, "", nic)
|
||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", nic)
|
||||
gsub(/ [ ]+/," ", nic)
|
||||
gsub(/^ +| +$/,"", nic)
|
||||
# The doublequotes above are necessary because of the pipes in the variable.
|
||||
|
|
Loading…
Reference in a new issue