mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
new version, new tarball. Added support for openSUSE repo syntax/location, as long as it's
zypp or yum it will work. If it's both then it will show only one I believe, if that's a possible scenario, no idea. Added one more fix for those pesky intel vm cpu core errors, now if /proc/cpuinfo shows no siblings at all, and no core_id, but does have physical id, it will use the count for physical id as a default for core count. Not perfect, but better than calling a dual core cpu a single core. There's still a lot of mysteries with vm versions of kvm cpus, for example, if you see a dual core xeon, is that actually one core with ht, or two cores? There is no way to find that information out that I can see that is reliable.
This commit is contained in:
parent
6888c8320d
commit
a1822fd07f
169
inxi
169
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 1.9.8
|
#### Version: 1.9.9
|
||||||
#### Date: June 14 2013
|
#### Date: June 16 2013
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -3603,6 +3603,7 @@ get_cpu_ht_multicore_smp_data()
|
||||||
num_of_processors = 0
|
num_of_processors = 0
|
||||||
num_of_cpus = 0
|
num_of_cpus = 0
|
||||||
cpu_core_count = 0
|
cpu_core_count = 0
|
||||||
|
siblings = 0
|
||||||
core_id[0]
|
core_id[0]
|
||||||
processor_id[0]
|
processor_id[0]
|
||||||
cpu_id[0]
|
cpu_id[0]
|
||||||
|
@ -3613,14 +3614,13 @@ get_cpu_ht_multicore_smp_data()
|
||||||
nr = 0
|
nr = 0
|
||||||
bArm = "false"
|
bArm = "false"
|
||||||
bXeon = "false"
|
bXeon = "false"
|
||||||
siblings = ""
|
|
||||||
}
|
}
|
||||||
# hack to handle xeons which can have buggy /proc/cpuinfo files
|
# hack to handle xeons which can have buggy /proc/cpuinfo files
|
||||||
/^model name/ && ( $0 ~ /Xeon/ ) {
|
/^model name/ && ( $0 ~ /Xeon/ ) {
|
||||||
bXeon = "true"
|
bXeon = "true"
|
||||||
}
|
}
|
||||||
# only do this once since sibling count does not change
|
# only do this once since sibling count does not change
|
||||||
/^siblings/ && ( bXeon == "true" ) && ( siblings == "" ) {
|
/^siblings/ && ( bXeon == "true" ) && ( siblings == 0 ) {
|
||||||
gsub(/[^0-9]/,"",$NF)
|
gsub(/[^0-9]/,"",$NF)
|
||||||
if ( $NF != "" ) {
|
if ( $NF != "" ) {
|
||||||
siblings = $NF
|
siblings = $NF
|
||||||
|
@ -3693,7 +3693,7 @@ get_cpu_ht_multicore_smp_data()
|
||||||
num_of_cores++
|
num_of_cores++
|
||||||
}
|
}
|
||||||
# xeon may show wrong core / physical id count, if it does, fix it
|
# xeon may show wrong core / physical id count, if it does, fix it
|
||||||
if ( num_of_cores == 1 && bXeon == "true" && siblings != "" && siblings > 1 ) {
|
if ( num_of_cores == 1 && bXeon == "true" && siblings > 1 ) {
|
||||||
num_of_cores = siblings/2
|
num_of_cores = siblings/2
|
||||||
}
|
}
|
||||||
# final check, override the num of cores value if it clearly is wrong
|
# final check, override the num of cores value if it clearly is wrong
|
||||||
|
@ -3701,6 +3701,11 @@ get_cpu_ht_multicore_smp_data()
|
||||||
if ( ( num_of_cores == 1 ) && ( cpu_core_count * num_of_cpus > 1 ) ) {
|
if ( ( num_of_cores == 1 ) && ( cpu_core_count * num_of_cpus > 1 ) ) {
|
||||||
num_of_cores = cpu_core_count * num_of_cpus
|
num_of_cores = cpu_core_count * num_of_cpus
|
||||||
}
|
}
|
||||||
|
# last check, seeing some intel cpus and vms with intel cpus that do not show any
|
||||||
|
# core id data at all, or siblings.
|
||||||
|
if ( num_of_cores == 0 && num_of_processors > 0 ) {
|
||||||
|
num_of_cores = num_of_processors
|
||||||
|
}
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# algorithm
|
# algorithm
|
||||||
|
@ -3708,12 +3713,12 @@ get_cpu_ht_multicore_smp_data()
|
||||||
# if > 1 processor && processor id (physical id) != core id then Multi-Core Processors (MCP)
|
# if > 1 processor && processor id (physical id) != core id then Multi-Core Processors (MCP)
|
||||||
# if > 1 processor && processor ids (physical id) > 1 then Multiple Processors (SMP)
|
# if > 1 processor && processor ids (physical id) > 1 then Multiple Processors (SMP)
|
||||||
# if = 1 processor then single core/processor Uni-Processor (UP)
|
# if = 1 processor then single core/processor Uni-Processor (UP)
|
||||||
if ( num_of_processors > 1 || ( bXeon == "true" && siblings != "" ) ) {
|
if ( num_of_processors > 1 || ( bXeon == "true" && siblings > 0 ) ) {
|
||||||
# non-multicore HT
|
# non-multicore HT
|
||||||
if ( num_of_processors == (num_of_cores * 2) ) {
|
if ( num_of_processors == (num_of_cores * 2) ) {
|
||||||
type = type "HT-"
|
type = type "HT-"
|
||||||
}
|
}
|
||||||
else if ( bXeon == "true" && siblings != "" && siblings > 1 ) {
|
else if ( bXeon == "true" && siblings > 1 ) {
|
||||||
type = type "HT-" # num_of_processors num_of_cores num_of_cpus
|
type = type "HT-" # num_of_processors num_of_cores num_of_cpus
|
||||||
}
|
}
|
||||||
# non-HT multi-core or HT multi-core
|
# non-HT multi-core or HT multi-core
|
||||||
|
@ -7274,10 +7279,11 @@ get_raid_component_data_bsd()
|
||||||
get_repo_data()
|
get_repo_data()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
local repo_file='' repo_data_working='' repo_data_working2='' repo_line=''
|
local repo_file='' repo_data_working='' repo_data_working2='' repo_line='' repo_files=''
|
||||||
|
local repo_name=''
|
||||||
local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf'
|
local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf'
|
||||||
local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/'
|
local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/'
|
||||||
local freebsd_conf='/etc/portsnap.conf'
|
local zypp_repo_dir='/etc/zypp/repos.d/' freebsd_conf='/etc/portsnap.conf'
|
||||||
|
|
||||||
# apt - debian, buntus, also sometimes some yum/rpm repos may create apt repos here as well
|
# apt - debian, buntus, also sometimes some yum/rpm repos may create apt repos here as well
|
||||||
if [[ -f $apt_file || -d $apt_file.d ]];then
|
if [[ -f $apt_file || -d $apt_file.d ]];then
|
||||||
|
@ -7288,76 +7294,85 @@ get_repo_data()
|
||||||
# actually running, inxi will merely note the existence of each repo type for apt/yum.
|
# actually running, inxi will merely note the existence of each repo type for apt/yum.
|
||||||
# Also, in rpm, you can install apt-rpm for the apt-get command, so it's not good to check for
|
# Also, in rpm, you can install apt-rpm for the apt-get command, so it's not good to check for
|
||||||
# only the commands in terms of selecting which repos to show.
|
# only the commands in terms of selecting which repos to show.
|
||||||
if [[ -d $yum_repo_dir || -f $yum_conf ]];then
|
if [[ -d $yum_repo_dir || -f $yum_conf || -d $zypp_repo_dir ]];then
|
||||||
# older redhats put their yum data in /etc/yum.conf
|
if [[ -d $yum_repo_dir || -f $yum_conf ]];then
|
||||||
for repo_file in $( ls $yum_repo_dir*.repo $yum_conf 2>/dev/null )
|
# older redhats put their yum data in /etc/yum.conf
|
||||||
do
|
repo_files=$( ls $yum_repo_dir*.repo $yum_conf 2>/dev/null )
|
||||||
repo_data_working="$( gawk -v repoFile=$repo_file '
|
repo_name='yum'
|
||||||
# construct the string for the print function to work with, file name: data
|
elif [[ -d $zypp_repo_dir ]];then
|
||||||
function print_line( fileName, repoId, repoUrl ){
|
repo_files=$( ls $zypp_repo_dir*.repo 2>/dev/null )
|
||||||
print "yum repos:" fileName ":" repoId repoUrl
|
repo_name='zypp'
|
||||||
}
|
fi
|
||||||
BEGIN {
|
if [[ -n $repo_files ]];then
|
||||||
FS="\n"
|
for repo_file in $repo_files
|
||||||
IGNORECASE=1
|
do
|
||||||
enabledStatus=""
|
repo_data_working="$( gawk -v repoFile=$repo_file '
|
||||||
repoTitle=""
|
# construct the string for the print function to work with, file name: data
|
||||||
urlData=""
|
function print_line( fileName, repoId, repoUrl ){
|
||||||
}
|
print "'$repo_name' sources:" fileName ":" repoId repoUrl
|
||||||
# this is a hack, assuming that each item has these fields listed, we collect the 3
|
|
||||||
# items one by one, then when the url/enabled fields are set, we print it out and
|
|
||||||
# reset the data. Not elegant but it works. Note that if enabled was not present
|
|
||||||
# we assume it is enabled then, and print the line, reset the variables. This will
|
|
||||||
# miss the last item, so it is printed if found in END
|
|
||||||
/^\[.+\]/ {
|
|
||||||
if ( urlData != "" && repoTitle != "" ){
|
|
||||||
print_line( repoFile, repoTitle, urlData )
|
|
||||||
enabledStatus=""
|
|
||||||
urlData=""
|
|
||||||
repoTitle=""
|
|
||||||
}
|
}
|
||||||
gsub( /\[|\]/, "", $1 ) # strip out the brackets
|
BEGIN {
|
||||||
repoTitle = $1 " ~ "
|
FS="\n"
|
||||||
}
|
IGNORECASE=1
|
||||||
/^(mirrorlist|baseurl)/ {
|
enabledStatus=""
|
||||||
sub( /(mirrorlist|baseurl)[[:space:]]*=[[:space:]]*/, "", $1 ) # strip out the field starter
|
repoTitle=""
|
||||||
urlData = $1
|
urlData=""
|
||||||
}
|
}
|
||||||
# note: enabled = 1. enabled = 0 means disabled
|
# this is a hack, assuming that each item has these fields listed, we collect the 3
|
||||||
/^enabled[[:space:]]*=/ {
|
# items one by one, then when the url/enabled fields are set, we print it out and
|
||||||
enabledStatus = $1
|
# reset the data. Not elegant but it works. Note that if enabled was not present
|
||||||
}
|
# we assume it is enabled then, and print the line, reset the variables. This will
|
||||||
# print out the line if all 3 values are found, otherwise if a new
|
# miss the last item, so it is printed if found in END
|
||||||
# repoTitle is hit above, it will print out the line there instead
|
/^\[.+\]/ {
|
||||||
{
|
if ( urlData != "" && repoTitle != "" ){
|
||||||
if ( urlData != "" && enabledStatus != "" && repoTitle != "" ){
|
print_line( repoFile, repoTitle, urlData )
|
||||||
if ( enabledStatus !~ /enabled[[:space:]]*=[[:space:]]*0/ ){
|
enabledStatus=""
|
||||||
|
urlData=""
|
||||||
|
repoTitle=""
|
||||||
|
}
|
||||||
|
gsub( /\[|\]/, "", $1 ) # strip out the brackets
|
||||||
|
repoTitle = $1 " ~ "
|
||||||
|
}
|
||||||
|
/^(mirrorlist|baseurl)/ {
|
||||||
|
sub( /(mirrorlist|baseurl)[[:space:]]*=[[:space:]]*/, "", $1 ) # strip out the field starter
|
||||||
|
urlData = $1
|
||||||
|
}
|
||||||
|
# note: enabled = 1. enabled = 0 means disabled
|
||||||
|
/^enabled[[:space:]]*=/ {
|
||||||
|
enabledStatus = $1
|
||||||
|
}
|
||||||
|
# print out the line if all 3 values are found, otherwise if a new
|
||||||
|
# repoTitle is hit above, it will print out the line there instead
|
||||||
|
{
|
||||||
|
if ( urlData != "" && enabledStatus != "" && repoTitle != "" ){
|
||||||
|
if ( enabledStatus !~ /enabled[[:space:]]*=[[:space:]]*0/ ){
|
||||||
|
print_line( repoFile, repoTitle, urlData )
|
||||||
|
}
|
||||||
|
enabledStatus=""
|
||||||
|
urlData=""
|
||||||
|
repoTitle=""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
# print the last one if there is data for it
|
||||||
|
if ( urlData != "" && repoTitle != "" ){
|
||||||
print_line( repoFile, repoTitle, urlData )
|
print_line( repoFile, repoTitle, urlData )
|
||||||
}
|
}
|
||||||
enabledStatus=""
|
|
||||||
urlData=""
|
|
||||||
repoTitle=""
|
|
||||||
}
|
}
|
||||||
}
|
' $repo_file )"
|
||||||
END {
|
|
||||||
# print the last one if there is data for it
|
# then load the global for each file as it gets filled
|
||||||
if ( urlData != "" && repoTitle != "" ){
|
if [[ -n $repo_data_working ]];then
|
||||||
print_line( repoFile, repoTitle, urlData )
|
if [[ -z $REPO_DATA ]];then
|
||||||
}
|
REPO_DATA="$repo_data_working"
|
||||||
}
|
else
|
||||||
' $repo_file )"
|
REPO_DATA="$REPO_DATA
|
||||||
|
|
||||||
# then load the global for each file as it gets filled
|
|
||||||
if [[ -n $repo_data_working ]];then
|
|
||||||
if [[ -z $REPO_DATA ]];then
|
|
||||||
REPO_DATA="$repo_data_working"
|
|
||||||
else
|
|
||||||
REPO_DATA="$REPO_DATA
|
|
||||||
$repo_data_working"
|
$repo_data_working"
|
||||||
|
fi
|
||||||
|
repo_data_working=''
|
||||||
fi
|
fi
|
||||||
repo_data_working=''
|
done
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
# pacman - archlinux, going to assume that pisi and arch/pacman don't have the above issue with apt/yum
|
# pacman - archlinux, going to assume that pisi and arch/pacman don't have the above issue with apt/yum
|
||||||
# pisi - pardus
|
# pisi - pardus
|
||||||
elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then
|
elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then
|
||||||
|
@ -9112,6 +9127,7 @@ print_hard_disk_data()
|
||||||
local hdd_capacity="${a_hdd_basic_working[0]}"
|
local hdd_capacity="${a_hdd_basic_working[0]}"
|
||||||
local hdd_used=${a_hdd_basic_working[1]}
|
local hdd_used=${a_hdd_basic_working[1]}
|
||||||
local bsd_unsupported='Hard drive data not yet supported for BSD systems.'
|
local bsd_unsupported='Hard drive data not yet supported for BSD systems.'
|
||||||
|
local hdd_name_temp=''
|
||||||
|
|
||||||
if [[ $B_SHOW_BASIC_DISK == 'true' || $B_SHOW_DISK == 'true' ]];then
|
if [[ $B_SHOW_BASIC_DISK == 'true' || $B_SHOW_DISK == 'true' ]];then
|
||||||
## note: the output part of this should be in the print hdd data function, not here
|
## note: the output part of this should be in the print hdd data function, not here
|
||||||
|
@ -9151,7 +9167,12 @@ print_hard_disk_data()
|
||||||
fi
|
fi
|
||||||
dev_data="${C1}id$SEP3${C2} /dev/${a_hdd_working[0]} "
|
dev_data="${C1}id$SEP3${C2} /dev/${a_hdd_working[0]} "
|
||||||
fi
|
fi
|
||||||
hdd_name="${C1}model$SEP3${C2} ${a_hdd_working[2]}"
|
if [[ -n ${a_hdd_working[2]} ]];then
|
||||||
|
hdd_name_temp=${a_hdd_working[2]}
|
||||||
|
else
|
||||||
|
hdd_name_temp='N/A'
|
||||||
|
fi
|
||||||
|
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
|
||||||
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
|
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
|
||||||
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
|
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
|
||||||
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
|
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 1.9.9
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: June 16 2013
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
new version, new tarball. Added support for openSUSE repo syntax/location, as long as it's
|
||||||
|
zypp or yum it will work. If it's both then it will show only one I believe, if that's a possible scenario, no idea.
|
||||||
|
|
||||||
|
Added one more fix for those pesky intel vm cpu core errors, now if /proc/cpuinfo shows no siblings at all,
|
||||||
|
and no core_id, but does have physical id, it will use the count for physical id as a default for core count.
|
||||||
|
|
||||||
|
Not perfect, but better than calling a dual core cpu a single core.
|
||||||
|
|
||||||
|
There's still a lot of mysteries with vm versions of kvm cpus, for example, if you see a dual core xeon, is
|
||||||
|
that actually one core with ht, or two cores? There is no way to find that information out that I can see that is
|
||||||
|
reliable.
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Sun, 16 Jun 2013 13:56:28 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 1.9.8
|
Version: 1.9.8
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue