mirror of
https://github.com/smxi/inxi.git
synced 2025-01-31 10:02:18 +00:00
branch one, first attempt to add suse zypp repo support, also a bug fix for intel vm cpu data
This commit is contained in:
parent
c9bdd0a982
commit
a75460b94e
45
inxi
45
inxi
|
@ -2,7 +2,7 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 1.9.8
|
#### Version: 1.9.8
|
||||||
#### Date: June 14 2013
|
#### Date: June 15 2013
|
||||||
#### Patch Number: 01-b1
|
#### Patch Number: 01-b1
|
||||||
########################################################################
|
########################################################################
|
||||||
#### 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
|
||||||
|
@ -5075,7 +5080,7 @@ get_hdd_data_basic()
|
||||||
# size += $3
|
# size += $3
|
||||||
# }
|
# }
|
||||||
# special case from this data: 8 0 156290904 sda
|
# special case from this data: 8 0 156290904 sda
|
||||||
# note: vm has 252/253 known starter, grsec has 202
|
# note: vm has 252/253/254 known starter, grsec has 202
|
||||||
$1 ~ /^(3|8|22|33|202|252|253|254)$/ && $NF ~ /[hsv]d[a-z]$/ && ( $2 % 16 == 0 || $2 % 16 == 8 ) {
|
$1 ~ /^(3|8|22|33|202|252|253|254)$/ && $NF ~ /[hsv]d[a-z]$/ && ( $2 % 16 == 0 || $2 % 16 == 8 ) {
|
||||||
size += $3
|
size += $3
|
||||||
}
|
}
|
||||||
|
@ -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,14 +7294,22 @@ 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 || -d $zypp_repo_dir ]];then
|
||||||
if [[ -d $yum_repo_dir || -f $yum_conf ]];then
|
if [[ -d $yum_repo_dir || -f $yum_conf ]];then
|
||||||
# older redhats put their yum data in /etc/yum.conf
|
# older redhats put their yum data in /etc/yum.conf
|
||||||
for repo_file in $( ls $yum_repo_dir*.repo $yum_conf 2>/dev/null )
|
repo_files=$( ls $yum_repo_dir*.repo $yum_conf 2>/dev/null )
|
||||||
|
repo_name='yum'
|
||||||
|
elif [[ -d $zypp_repo_dir ]];then
|
||||||
|
repo_files=$( ls $zypp_repo_dir 2>/dev/null )
|
||||||
|
repo_name='zypp'
|
||||||
|
fi
|
||||||
|
if [[ -n $repo_files ]];then
|
||||||
|
for repo_file in $repo_files
|
||||||
do
|
do
|
||||||
repo_data_working="$( gawk -v repoFile=$repo_file '
|
repo_data_working="$( gawk -v repoFile=$repo_file '
|
||||||
# construct the string for the print function to work with, file name: data
|
# construct the string for the print function to work with, file name: data
|
||||||
function print_line( fileName, repoId, repoUrl ){
|
function print_line( fileName, repoId, repoUrl ){
|
||||||
print "yum repos:" fileName ":" repoId repoUrl
|
print "'$repo_name':" fileName ":" repoId repoUrl
|
||||||
}
|
}
|
||||||
BEGIN {
|
BEGIN {
|
||||||
FS="\n"
|
FS="\n"
|
||||||
|
@ -7358,6 +7372,7 @@ $repo_data_working"
|
||||||
repo_data_working=''
|
repo_data_working=''
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
# 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.
|
||||||
|
|
Loading…
Reference in a new issue