fixed for older systems, -M with dmidecode can be empty, so error messages should also show that.

This commit is contained in:
inxi-svn 2012-03-26 22:17:27 +00:00
parent e64687d88f
commit ef8f431ec4

11
inxi
View file

@ -4316,8 +4316,12 @@ get_machine_data()
separator=','
done
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
# this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data
if [[ -z $( dmidecode 2>/dev/null | grep -i 'no smbios or dmi' ) ]];then
array_string='dmidecode-no-smbios-dmi-data'
else
for dmi_name in $dmi_names
do
# echo "$dmi_name" >&2
@ -4344,6 +4348,7 @@ get_machine_data()
array_string="$array_string$separator$dmi_data"
separator=','
done
fi
else
array_string='dmidecode-non-root-user'
fi
@ -6935,8 +6940,12 @@ print_machine_data()
system_line="${C2}No /sys machine data. Try newer kernel, or install dmidecode.${CN}"
fi
# patch to dump all of above if dmidecode was data source and non root user
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' || ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
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=''
bios_line=''
chassis_line=''