mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
fixed for older systems, -M with dmidecode can be empty, so error messages should also show that.
This commit is contained in:
parent
e64687d88f
commit
ef8f431ec4
67
inxi
67
inxi
|
@ -4316,34 +4316,39 @@ get_machine_data()
|
||||||
separator=','
|
separator=','
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
if [[ -n $( type -p dmidecode 2>/dev/null ) ]];then
|
if [[ -n $( type -p dmidecode 2>/dev/null ) && -n $( dmidecode 2>/dev/null ) ]];then
|
||||||
if [[ $B_ROOT == 'true' ]];then
|
if [[ $B_ROOT == 'true' ]];then
|
||||||
for dmi_name in $dmi_names
|
# this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data
|
||||||
do
|
if [[ -z $( dmidecode 2>/dev/null | grep -i 'no smbios or dmi' ) ]];then
|
||||||
# echo "$dmi_name" >&2
|
array_string='dmidecode-no-smbios-dmi-data'
|
||||||
dmi_data=''
|
else
|
||||||
dmi_data=$( dmidecode -s $dmi_name | gawk '
|
for dmi_name in $dmi_names
|
||||||
BEGIN {
|
do
|
||||||
IGNORECASE=1
|
# echo "$dmi_name" >&2
|
||||||
}
|
dmi_data=''
|
||||||
{
|
dmi_data=$( dmidecode -s $dmi_name | gawk '
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $0)
|
BEGIN {
|
||||||
gsub(/,/, " ", $0)
|
IGNORECASE=1
|
||||||
# yes, there is a typo in a user data set, unknow
|
}
|
||||||
# Base Board Version|Base Board Serial Number
|
{
|
||||||
# Chassis Manufacturer|Chassis Version|Chassis Serial Number
|
gsub(/'"$BAN_LIST_NORMAL"'/, "", $0)
|
||||||
# System manufacturer|System Product Name|System Version
|
gsub(/,/, " ", $0)
|
||||||
# To Be Filled By O.E.M.
|
# yes, there is a typo in a user data set, unknow
|
||||||
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*/, "", $0)
|
# Base Board Version|Base Board Serial Number
|
||||||
gsub(/bios|acpi/, "", $0)
|
# Chassis Manufacturer|Chassis Version|Chassis Serial Number
|
||||||
sub(/http:\/\/www.abit.com.tw\//, "Abit", $0)
|
# System manufacturer|System Product Name|System Version
|
||||||
gsub(/^ +| +$/, "", $0)
|
# To Be Filled By O.E.M.
|
||||||
gsub(/ [ \t]+/, " ", $0)
|
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*/, "", $0)
|
||||||
print $0
|
gsub(/bios|acpi/, "", $0)
|
||||||
}' )
|
sub(/http:\/\/www.abit.com.tw\//, "Abit", $0)
|
||||||
array_string="$array_string$separator$dmi_data"
|
gsub(/^ +| +$/, "", $0)
|
||||||
separator=','
|
gsub(/ [ \t]+/, " ", $0)
|
||||||
done
|
print $0
|
||||||
|
}' )
|
||||||
|
array_string="$array_string$separator$dmi_data"
|
||||||
|
separator=','
|
||||||
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
array_string='dmidecode-non-root-user'
|
array_string='dmidecode-non-root-user'
|
||||||
fi
|
fi
|
||||||
|
@ -6935,8 +6940,12 @@ print_machine_data()
|
||||||
system_line="${C2}No /sys machine data. Try newer kernel, or install dmidecode.${CN}"
|
system_line="${C2}No /sys machine data. Try newer kernel, or install dmidecode.${CN}"
|
||||||
fi
|
fi
|
||||||
# patch to dump all of above if dmidecode was data source and non root user
|
# patch to dump all of above if dmidecode was data source and non root user
|
||||||
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' ]];then
|
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' || ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
|
||||||
system_line="${C2}You must be root to use dmidecode. Fallback mode from non-present /sys data.${CN}"
|
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' ]];then
|
||||||
|
system_line="${C2}You must be root to use dmidecode. Fallback mode from non-present /sys data.${CN}"
|
||||||
|
elif [[ ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
|
||||||
|
system_line="${C2}No dmidecode data available for system. Fallback mode from non-present /sys data.${CN}"
|
||||||
|
fi
|
||||||
mobo_line=''
|
mobo_line=''
|
||||||
bios_line=''
|
bios_line=''
|
||||||
chassis_line=''
|
chassis_line=''
|
||||||
|
|
Loading…
Reference in a new issue