branch one, more ram fixes

This commit is contained in:
inxi-svn 2014-08-13 03:06:08 +00:00
parent fcb9adf33a
commit e39001ed32

591
inxi
View file

@ -1,9 +1,9 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.1.28
#### Date: 2014-08-07
#### Patch Number: 08-b1
#### Version: 2.1.91
#### Date: 2014-08-12
#### Patch Number: 01-b1
########################################################################
#### SPECIAL THANKS
########################################################################
@ -1832,7 +1832,7 @@ debug_data_collector()
echo 'Creating inxi output file now. This can take a few seconds...'
echo "Starting $SCRIPT_NAME from: $start_directory"
cd $start_directory
$SCRIPT_PATH/$SCRIPT_NAME -FRfrploudxxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudxxxy120.txt
$SCRIPT_PATH/$SCRIPT_NAME -FRfrploudixxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudixxxy120.txt
cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir
if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then
echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz"
@ -2410,6 +2410,7 @@ get_parameters()
if [[ $OPTARG -ge 5 ]];then
B_SHOW_AUDIO='true'
B_SHOW_BASIC_OPTICAL='true'
B_SHOW_MEMORY='true'
B_SHOW_SENSORS='true'
B_SHOW_LABELS='true'
B_SHOW_UUIDS='true'
@ -2660,6 +2661,7 @@ show_options()
network tool). Same as -Nni. Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
print_lines_basic "1" "-I" "Information: processes, uptime, memory, irc client (or shell type), $SCRIPT_NAME version."
print_lines_basic "1" "-l" "$partition_string_u labels. Default: short $partition_string -P. For full -p output, use: -pl (or -plu)."
print_lines_basic "1" "-m" "Memory (RAM) data. Physical system memory array(s), capacity, how many devices (slots) supported, and individual memory devices (sticks of memory etc). For devices, shows device locator, size, speed, type (like: DDR3). Also see -x, -xx, -xxx"
print_lines_basic "1" "-M" "Machine data. Motherboard, Bios, and if present, System Builder (Like Lenovo). Older systems/kernels without the required /sys data can use dmidecode instead, run as root. Dmidecode can be forced with -! 33"
print_lines_basic "1" "-n" "Advanced Network card information. Same as -Nn. Shows interface, speed, mac id, state, etc."
print_lines_basic "1" "-N" "Network card information. With -x, shows PCI BusID, Port number."
@ -2680,7 +2682,7 @@ show_options()
print_lines_basic "2" "2" "Networking card (-N), Machine (-M) data, shows basic hard disk data (names only), and, if present, basic raid (devices only, and if inactive, notes that). similar to: $SCRIPT_NAME^-b"
print_lines_basic "2" "3" "Advanced CPU (-C), network (-n) data, and switches on -x advanced data option."
print_lines_basic "2" "4" "$partition_string_u size/filled data (-P) for (if present): /, /home, /var/, /boot. Shows full disk data (-D)."
print_lines_basic "2" "5" "Audio card (-A); sensors^(-s), $partition_string label^(-l) and UUID^(-u), short form of optical drives, standard raid data (-R)."
print_lines_basic "2" "5" "Audio card (-A); sensors^(-s), memory/ram^(-m), $partition_string label^(-l) and UUID^(-u), short form of optical drives, standard raid data (-R)."
print_lines_basic "2" "6" "Full $partition_string (-p), unmounted $partition_string (-o), optical drive (-d), full raid; triggers -xx."
print_lines_basic "2" "7" "Network IP data (-i); triggers -xxx."
@ -2697,6 +2699,7 @@ show_options()
print_lines_basic "2" "-G" "(for single gpu, nvidia driver) screen number gpu is running on."
print_lines_basic "2" "-i" "IPv6 as well for LAN interface (IF) devices."
print_lines_basic "2" "-I" "System GCC, default. With -xx, also show other installed GCC versions. If running in console, not in IRC client, shows shell version number, if detected. Init/RC Type and runlevel (if available)."
print_lines_basic "2" "-m" "Part number."
print_lines_basic "2" "-N -A" "Version/port(s)/driver version (if available) for Network/Audio;"
print_lines_basic "2" "-N -A -G" "Network, audio, graphics, shows PCI Bus ID/Usb ID number of card."
print_lines_basic "2" "-R" "md-raid: Shows component raid id. Adds second RAID Info line: raid level; report on drives (like 5/5); blocks; chunk size; bitmap (if present). Resync line, shows blocks synced/total blocks. zfs-raid: Shows raid array full size; available size; portion allocated to RAID"
@ -2710,6 +2713,7 @@ show_options()
print_lines_basic "2" "-D" "Disk serial number."
print_lines_basic "2" "-G" "Chip vendor:product ID for each video card."
print_lines_basic "2" "-I" "Other detected installed gcc versions (if present). System default runlevel. Adds parent program (or tty) for shell info if not in IRC (like Konsole or Gterm). Adds Init/RC (if found) version number."
print_lines_basic "2" "-m" "Manufacturer, Serial Number."
print_lines_basic "2" "-M" "Chassis information, bios rom size (dmidecode only), if data for either is available."
print_lines_basic "2" "-N" "Chip vendor:product ID for each nic."
print_lines_basic "2" "-R" "md-raid: Superblock (if present); algorythm, U data. Adds system info line (kernel support,read ahead, raid events). If present, adds unused device line. Resync line, shows progress bar."
@ -2719,6 +2723,7 @@ show_options()
fi
print_lines_basic "2" "-@ 11-14" "Automatically uploads debugger data tar.gz file to ftp.techpatterns.com. EG: $SCRIPT_NAME^-xx@14"
print_lines_basic "1" "-xxx" "Show extra, extra, extra data (only works with verbose or line output, not short form):"
print_lines_basic "2" "-m" "Width of channel, data and total. Detail, if present, for Type."
print_lines_basic "2" "-S" "Panel/shell information in desktop output, if in X (like gnome-shell, cinnamon, mate-panel)."
if [[ $B_ALLOW_WEATHER == 'true' ]];then
print_lines_basic "2" "-w -W" "Location (uses -z/irc filter), weather observation time, wind chill, heat index, dew point (shows extra lines for data where relevant)."
@ -4884,17 +4889,23 @@ get_dmidecode_data()
{
eval $LOGFS
local dmiData="$( cat /home/harald/bin/scripts/inxi/data/dmidecode/dmidecode-memory-variants-1.txt )
"
local dmidecodePath=''
if [[ $B_DMIDECODE_SET != 'true' ]];then
dmidecodePath=$( type -p dmidecode 2>/dev/null )
if [[ -n $dmidecodePath ]];then
if [[ -z $dmidecodePath ]];then
DMIDECODE_DATA='dmidecode-error-not-installed'
else
# note stripping out these lines: Handle 0x0016, DMI type 17, 27 bytes
# but NOT deleting them, in case the dmidecode data is missing empty lines which will be
# used to separate results. Then we remove the doubled empty lines to keep it clean and
# strip out all the stuff we don't want to see in the results.
DMIDECODE_DATA="$( $dmidecodePath 2>/dev/null \
| gawk -F ':' '
# strip out all the stuff we don't want to see in the results. We want the error data in
# stdout for error handling
# DMIDECODE_DATA="$( echo "$dmiData" | gawk -F ':' '
# DMIDECODE_DATA="$( $dmidecodePath 2>&1 | gawk -F ':' '
DMIDECODE_DATA="$( echo "$dmiData" | gawk -F ':' '
BEGIN {
IGNORECASE=1
cutExtraTab="false"
@ -4915,11 +4926,12 @@ get_dmidecode_data()
sub(/^\tDMI type.*/, "", $0)
cutExtraTab="true"
}
gsub(/'"$BAN_LIST_NORMAL"'/, "", twoData)
gsub(/,/, " ", $0)
gsub(/,/, " ", twoData)
# clean out Handle line
# sub(/^Handle.*/,"", $0)
sub(/^[[:space:]]*Inactive.*/,"",$0)
sub(/^[[:space:]]*Inactive.*/,"",twoData)
# 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
@ -4927,8 +4939,8 @@ get_dmidecode_data()
# To Be Filled By O.E.M.
# strip out starting white space so that the following stuff will clear properly
sub(/^[[:space:]]+/, "", twoData)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*/, "", twoData)
sub(/(AssetTagNum|Manufacturer| Or Motherboard|PartNum|SerNum).*/, "", twoData)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$/, "", twoData)
sub(/.*(AssetTagNum|Manufacturer| Or Motherboard|PartNum.*|SerNum).*/, "", twoData)
gsub(/bios|acpi/, "", twoData)
sub(/http:\/\/www.abit.com.tw\//, "Abit", twoData)
@ -4941,7 +4953,6 @@ get_dmidecode_data()
else {
sub(/^\t\t+/, "~", oneData)
}
gsub(/^[[:space:]]+|[[:space:]]+$/, "", twoData)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", oneData)
gsub(/ [ \t]+/, " ", twoData)
@ -4958,9 +4969,23 @@ N
/^\n$/D
}' \
)"
# echo ":${DMIDECODE_DATA}:"
log_function_data "DMIDECODE_DATA (PRE): $DMIDECODE_DATA"
if [[ ${#DMIDECODE_DATA} -lt 100 ]];then
if [[ -z ${DMIDECODE_DATA/*Permission denied*/} ]];then
# if [[ -n $( grep -i 'Permission denied' <<< "$DMIDECODE_DATA" ) ]];then
DMIDECODE_DATA='dmidecode-error-requires-root'
# this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data
elif [[ -n $( grep -i 'no smbios ' <<< "$DMIDECODE_DATA" ) ]];then
DMIDECODE_DATA='dmidecode-error-no-smbios-dmi-data'
else
echo $DMIDECODE_DATA
DMIDECODE_DATA='dmidecode-error-unknown-error'
fi
fi
fi
B_DMIDECODE_SET='true'
log_function_data "DMIDECODE_DATA: $DMIDECODE_DATA"
log_function_data "DMIDECODE_DATA (POST): $DMIDECODE_DATA"
fi
eval $LOGFE
@ -6074,7 +6099,6 @@ get_machine_data()
board_vendor board_name board_version board_serial
bios_vendor bios_version bios_date
"
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
machine_files="$machine_files
chassis_vendor chassis_type chassis_version chassis_serial
@ -6111,10 +6135,8 @@ get_machine_data()
else
get_dmidecode_data
if [[ -n $DMIDECODE_DATA ]];then
if [[ $B_ROOT == 'true' ]];then
# this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data
if [[ -n $( grep -i 'no smbios ' <<< "$DMIDECODE_DATA" ) ]];then
array_string='dmidecode-no-smbios-dmi-data'
if [[ $DMIDECODE_DATA == 'dmidecode-error-'* ]];then
array_string=$DMIDECODE_DATA
# please note: only dmidecode version 2.11 or newer supports consistently the -s flag
else
array_string=$( gawk -F ':' '
@ -6203,6 +6225,9 @@ get_machine_data()
exit # stop the loop
}
END {
# sys_vendor product_name product_version product_serial product_uuid
# board_vendor board_name board_version board_serial
# bios_vendor bios_version bios_date
if ( bItemFound == "true" ) {
fullString = systemManufacturer "," systemProductName "," systemVersion "," systemSerialNumber
fullString = fullString "," systemUuid "," baseboardManufacturer "," baseboardProductName
@ -6215,16 +6240,15 @@ get_machine_data()
}
}' <<< "$DMIDECODE_DATA" )
fi
else
array_string='dmidecode-non-root-user'
fi
fi
fi
echo $array_string
IFS=','
A_MACHINE_DATA=( $array_string )
IFS="$ORIGINAL_IFS"
a_temp=${A_MACHINE_DATA[@]}
# echo ${a_temp[@]}
# echo ${A_MACHINE_DATA[5]}
a_temp=( ${A_MACHINE_DATA[@]} )
# echo ${#a_temp[@]}
log_function_data "A_MACHINE_DATA: $a_temp"
eval $LOGFE
}
@ -6334,7 +6358,7 @@ get_networking_data()
echo "$Lspci_v_Data" | gawk '
# NOTE: see version 2.1.28 or earlier for old logic if for some reason it is needed again
# that used a modified string made from nic name for index, why, I have no idea, makes no sense and leads
# to wrong ordered output as well.
# to wrong ordered output as well. get_audio_data uses the old logic for now too.
BEGIN {
IGNORECASE=1
counter=0
@ -6363,7 +6387,6 @@ get_networking_data()
}
counter++
}
END {
for (i=0;i<counter;i++) {
useDrivers=""
@ -6424,14 +6447,12 @@ get_network_advanced_data()
# reset these every go round
driver_test=''
if_data=''
if_id=''
speed=''
duplex=''
mac_id=''
oper_state=''
product_path=''
usb_data=''
chip_id=''
usb_product=''
usb_vendor=''
working_path=''
working_uevent_path=''
if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then
# note although this may exist technically don't use it, it's a virtual path
# and causes weird cat errors when there's a missing file as well as a virtual path
@ -6484,7 +6505,6 @@ get_network_advanced_data()
product_path=$( grep -s "$usb_product" /sys/devices/pci*/*/usb*/*/*/idProduct | \
sed -e "s/idProduct:$usb_product//" -e '/driver/d' )
fi
# make sure it's the right product/vendor match here, it will almost always be but let's be sure
if [[ -n $working_path && -n $product_path ]] && [[ $working_path == $product_path ]];then
#if [[ -n $working_path ]];then
@ -6504,10 +6524,6 @@ get_network_advanced_data()
fi
#echo wp: $working_path
log_function_data "PRE: working_path: $working_path\nworking_uevent_path: $working_uevent_path"
# some cases of failure will return root / instead of null
if [[ $working_path == '/' ]];then
working_path=''
fi
# this applies in two different cases, one, default, standard, two, for usb, this is actually
# the short path, minus the last longer numeric directory name, ie:
# from debian squeeze 2.6.32-5-686:
@ -6517,33 +6533,33 @@ get_network_advanced_data()
# with line break in output
if_data=$( ls $working_path/net 2>/dev/null )
b_path_made='false'
#echo yes
# this is the normal usb detection if the first one didn't work
elif [[ -n $usb_data && -e $working_uevent_path/net ]];then
if_data=$( ls $working_uevent_path/net 2>/dev/null )
if_id=$if_data
working_path=$working_uevent_path/net/$if_data
# 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0
elif [[ -n $working_path ]];then
elif [[ -n ${working_path/\/sys*/} ]];then
if_data=$( ls $working_path 2>/dev/null | grep 'net:' )
if_id=$( cut -d ':' -f 2 <<< "$if_data" )
if [[ -n $if_data ]];then
working_path=$working_path/$if_data
# we won't be using this for path any more, just the actual if id output
# so prep it for the loop below
if_data=$( cut -d ':' -f 2 <<< "$if_data" )
fi
fi
# just in case we got a failed path, like /net or /, clear it out for tests below
if [[ -n ${working_path/\/sys*/} ]];then
working_path=''
fi
#echo id: $if_data
log_function_data "POST: working_path: $working_path\nif_data: $if_data - if_id: $if_id"
## note: in cases of dual ports with different ids, this loop will create extra array items
# if_data="eth0
# eth2
# ib1"
# echo if_data $if_data
# there are virtual devices that will have no if data but which we still want in the array
# as it loops. These will also have null working_path as well since no /net is found
# as it loops. These will also have null working_path as well since no **/net is found
# echo if_data: $if_data
if [[ -z $if_data ]];then
if_data='null-if-id'
fi
# if_data=$(tr '\n' ' ' <<< $if_data)
#if_data=$(echo $if_data)
## note: in cases of dual ports with different ids, this loop will create extra array items
for if_item in $if_data
do
chip_id=
@ -6553,20 +6569,16 @@ get_network_advanced_data()
mac_id=''
oper_state=''
speed=''
if [[ $working_path != '' ]];then
#echo wp1: $working_path
# strip out trailing spaces
if_item=${if_item%% }
#echo wp1: $working_path
if [[ $working_path != '' ]];then
if_id=$if_item
if [[ $b_path_made == 'false' ]];then
full_path=$working_path/net/$if_item
if_id=$if_item
else
full_path=$working_path
fi
#echo fp: $full_path
#echo id: $if_id
# echo "$if_data ii: $if_item $array_counter i: $i"
if [[ -r $full_path/speed ]];then
speed=$( cat $full_path/speed 2>/dev/null )
fi
@ -6582,10 +6594,11 @@ get_network_advanced_data()
if [[ -n ${a_network_adv_working[10]} ]];then
chip_id=${a_network_adv_working[10]}
fi
# now we create one array index per id found, note that one pcibusid device can have > 1 id
else
if_id=''
fi
#echo fp: $full_path
#echo id: $if_id
# echo "$if_data ii: $if_item $array_counter i: $i"
A_NETWORK_DATA[$array_counter]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id
((array_counter++))
@ -8095,6 +8108,187 @@ get_raid_component_data_bsd()
}
# get_raid_data_bsd;exit
get_ram_data()
{
eval $LOGFS
local a_temp='' array_string=''
get_dmidecode_data
if [[ -n $DMIDECODE_DATA ]];then
if [[ $DMIDECODE_DATA == 'dmidecode-error-'* ]];then
A_MEMORY_DATA[0]=$DMIDECODE_DATA
# please note: only dmidecode version 2.11 or newer supports consistently the -s flag
else
IFS=$'\n'
A_MEMORY_DATA=( $(
gawk -F ':' '
BEGIN {
IGNORECASE=1
arrayHandle=""
bankLocator=""
clockSpeed=""
configuredClockSpeed=""
dataWidth=""
deviceManufacturer=""
devicePartNumber=""
deviceSerialNumber=""
deviceSpeed=""
deviceType=""
deviceTypeDetail=""
deviceSize=""
errorCorrection=""
formFactor=""
handle=""
location=""
locator=""
maxCapacity=""
numberOfDevices=""
primaryType=""
totalWidth=""
use=""
}
/^Handle .* DMI type 16/ {
primaryType="memory-array"
arrayHandle=gensub(/Handle[[:space:]]([0-9a-zA-Z]+)([[:space:]]|,).*/,"\\1",$0)
while ( getline && !/^$/ ) {
# print $0
if ( $1 == "Maximum Capacity") {
maxCapacity=$2
}
# note: these 3 have cleaned data in get_dmidecode_data, so replace stuff manually
if ( $1 == "Location") {
sub(/[[:space:]]Or[[:space:]]Motherboard/,"",$2)
location=$2
if ( location == "" ){
location="System Board"
}
}
if ( $1 == "Use") {
use=$2
if ( use == "" ){
use="System Memory"
}
}
if ( $1 == "Error Correction Type") {
errorCorrection=$2
if ( errorCorrection == "" ){
errorCorrection="No"
}
}
if ( $1 == "Number of Devices") {
numberOfDevices=$2
}
}
print primaryType "," arrayHandle "," location "," maxCapacity "," numberOfDevices "," use "," errorCorrection
# reset
primaryType=""
arrayHandle=""
location=""
maxCapacity=""
numberOfDevices=""
use=""
errorCorrection=""
}
/^Handle .* DMI type 17/ {
primaryType="memory-device"
while ( getline && !/^$/ ) {
if ( $1 == "Array Handle") {
arrayHandle=$2
}
if ( $1 == "Data Width") {
dataWidth=$2
}
if ( $1 == "Total Width") {
totalWidth=$2
}
if ( $1 == "Size") {
deviceSize=$2
}
if ( $1 == "Locator") {
# sub(/.*_/,"",$2)
#sub(/RAM slot #|^DIMM/, "Slot",$2)
sub(/RAM slot #/, "Slot",$2)
#locator=toupper($2)
locator=$2
}
if ( $1 == "Bank Locator") {
#sub(/_.*/,"",$2)
#sub(/RAM slot #|Channel|Chan/,"bank",$2)
#sub(/RAM slot #|Channel|Chan/,"bank",$2)
#bankLocator=toupper($2)
bankLocator=$2
}
if ( $1 == "Form Factor") {
formFactor=$2
}
if ( $1 == "Type") {
deviceType=$2
}
if ( $1 == "Type Detail") {
deviceTypeDetail=$2
}
if ( $1 == "Speed") {
deviceSpeed=$2
}
if ( $1 == "Configured Clock Speed") {
configuredClockSpeed=$2
}
if ( $1 == "Manufacturer") {
gsub(/(^[0]+$|Undefined.*|.*Manufacturer.*)/,"",$2)
deviceManufacturer=$2
}
if ( $1 == "Part Number") {
sub(/(^[0]+$||.*Module.*|Undefined.*)/,"",$2)
devicePartNumber=$2
}
if ( $1 == "Serial Number") {
gsub(/(^[0]+$|Undefined.*)/,"",$2)
deviceSerialNumber=$2
}
}
# because of the wide range of bank/slot type data, we will just use
# the one that seems most likely to be right. Some have: Bank: SO DIMM 0 slot: J6A
# so we dump the useless data and use the one most likely to be visibly correct
if ( bankLocator ~ /DIMM/ ) {
mainLocator=bankLocator
}
else {
mainLocator=locator
}
print primaryType "," arrayHandle "," deviceSize "," bankLocator "," locator "," formFactor "," deviceType "," deviceTypeDetail "," deviceSpeed "," configuredClockSpeed "," dataWidth "," totalWidth "," deviceManufacturer "," devicePartNumber "," deviceSerialNumber "," mainLocator
primaryType=""
arrayHandle=""
deviceSize=""
bankLocator=""
locator=""
mainLocator=""
mainLocator=""
formFactor=""
deviceType=""
deviceTypeDetail=""
deviceSpeed=""
configuredClockSpeed=""
dataWidth=""
totalWidth=""
deviceManufacturer=""
devicePartNumber=""
deviceSerialNumber=""
} ' <<< "$DMIDECODE_DATA" ) )
fi
fi
IFS="$ORIGINAL_IFS"
a_temp=${A_MEMORY_DATA[@]}
# echo "${a_temp[@]}"
log_function_data "A_MEMORY_DATA: $a_temp"
eval $LOGFE
}
# Repos will be added as we get distro package manager data to create the repo data.
# This method will output the file name also, which is useful to create output that's
# neat and readable. Each line of the total number contains the following sections,
@ -9447,7 +9641,7 @@ print_it_out()
print_cpu_data
fi
if [[ $B_SHOW_MEMORY == 'true' ]];then
print_memory_data
print_ram_data
fi
if [[ $B_SHOW_GRAPHICS == 'true' ]];then
print_graphics_data
@ -9977,6 +10171,32 @@ print_cpu_flags_full()
eval $LOGFE
}
# args: $1 - type [sys/default]; $2 - get_dmidecode_data error return
print_dmidecode_error()
{
eval $LOGFS
local error_message='Unknown dmidecode error.'
local sysDmiError='Using '
if [[ $1 == 'sys' ]];then
sysDmiError='No /sys/class/dmi; using '
fi
if [[ $B_FORCE_DMIDECODE == 'true' && $1 == 'sys' ]];then
sysDmiError='Forcing '
fi
if [[ $2 == 'dmidecode-error-requires-root' ]];then
error_message="${sysDmiError}dmidecode: you must be root to run dmidecode"
elif [[ $2 == 'dmidecode-error-not-installed' ]];then
error_message="${sysDmiError}dmidecode: dmidecode is not installed."
elif [[ $2 == 'dmidecode-error-no-smbios-dmi-data' ]];then
error_message="${sysDmiError}dmidecode: no smbios data available. Old system?"
elif [[ $2 == 'dmidecode-error-unknown-error' ]];then
error_message="${sysDmiError}dmidecode: unknown error occured"
fi
echo $error_message
eval $LOGFE
}
print_graphics_data()
{
eval $LOGFS
@ -10494,20 +10714,14 @@ print_machine_data()
local system_line='' mobo_line='' bios_line='' chassis_line=''
local mobo_vendor='' mobo_model='' mobo_version='' mobo_serial=''
local bios_vendor='' bios_version='' bios_date='' bios_rom=''
local bios_vendor='' bios_version='' bios_date='' bios_rom='' error_string=''
local system_vendor='' product_name='' product_version='' product_serial='' product_uuid=''
local chassis_vendor='' chassis_type='' chassis_version='' chassis_serial=''
local b_skip_system='false' b_skip_chassis='false'
local sysDmiError='No /sys/class/dmi, using '
local sysDmiNull='No /sys/class/dmi machine data: try newer kernel, or install dmidecode'
# set A_MACHINE_DATA
get_machine_data
if [[ -n $BSD_TYPE || $B_FORCE_DMIDECODE == 'true' ]];then
sysDmiError=''
sysDmiNull='No machine data available. Is dmidecode installed?'
fi
IFS=','
## keys for machine data are:
# 0-sys_vendor 1-product_name 2-product_version 3-product_serial 4-product_uuid
@ -10515,8 +10729,8 @@ print_machine_data()
# 9-bios_vendor 10-bios_version 11-bios_date
## with extra data:
# 12-chassis_vendor 13-chassis_type 14-chassis_version 15-chassis_serial
if [[ ${#A_MACHINE_DATA[@]} -gt 0 ]];then
# a null array always has a count of 1
if [[ ${#A_MACHINE_DATA[@]} -gt 1 ]];then
# note: in some case a mobo/version will match a product name/version, do not print those
# but for laptops, or even falsely id'ed desktops with batteries, let's print it all if it matches
# there can be false id laptops if battery appears so need to make sure system is filled
@ -10628,18 +10842,14 @@ print_machine_data()
chassis_line=''
fi
fi
IFS="$ORIGINAL_IFS"
else
system_line="${C2}$sysDmiNull"
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}${sysDmiError}dmidecode: you must be root to run dmidecode"
elif [[ ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
system_line="${C2}${sysDmiError}dmidecode: no machine data available"
fi
IFS="$ORIGINAL_IFS"
# patch to dump all of above if dmidecode was data source and a dmidecode error is present
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-'* ]];then
error_string=$( print_dmidecode_error 'sys' "${A_MACHINE_DATA[0]}" )
system_line=${C2}$error_string
mobo_line=''
bios_line=''
chassis_line=''
@ -10662,26 +10872,6 @@ print_machine_data()
eval $LOGFE
}
print_memory_data()
{
eval $LOGFS
local memory_line="${C1}Placeholder$SEP3${C2} Feature not yet developed"
memory_line=$( create_print_line "Memory:" "$memory_line${CN}" )
print_screen_output "$memory_line"
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' || \
${A_MEMORY_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' ]];then
memory_line="${C2}${sysDmiError}dmidecode: you must be root to run dmidecode"
elif [[ ${A_MEMORY_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
memory_line="${C2}${sysDmiError}dmidecode: no machine data available"
fi
fi
eval $LOGFE
}
# args: $1 - module name (could be > 1, so loop it ); $2 - audio (optional)
print_module_version()
{
@ -11694,6 +11884,207 @@ print_raid_data()
eval $LOGFE
}
print_ram_data()
{
eval $LOGFS
local memory_line='' line_2='' line_3='' b_module_present='true'
local error_string='' a_memory_item='' line_starter='Memory:' array_counter=0
local dmidecodeNull='No dmidecode memory data: try newer kernel.'
local manufacturer='' part_nu='' serial_nu='' device_speed='' configured_speed=''
local data_width='' total_width='' device_type='' device_type_detail='' bank='' slot='' form_factor=''
local device_size='' array_use='' location='' error_correction='' max_capacity='' nu_of_devices=''
get_ram_data
#echo ${#A_MEMORY_DATA[@]}
#echo ${A_MEMORY_DATA[0]}
if [[ ${#A_MEMORY_DATA[@]} -gt 0 ]];then
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-'* ]];then
error_string=$( print_dmidecode_error 'default' "${A_MEMORY_DATA[0]}" )
memory_line="${C2}$error_string"
else
for (( i=0;i<${#A_MEMORY_DATA[@]};i++ ))
do
IFS=','
a_memory_item=(${A_MEMORY_DATA[i]})
IFS="$ORIGINAL_IFS"
memory_line=''
line_2=''
line_3=''
part_nu=''
serial_nu=''
manufacturer=''
# memory-array,0x0012,System Board,8 GB,4,System Memory,None
if [[ ${a_memory_item[0]} == 'memory-array' ]];then
if [[ -n ${a_memory_item[4]} ]];then
nu_of_devices=${a_memory_item[4]}
else
nu_of_devices='N/A'
fi
if [[ -n ${a_memory_item[3]} ]];then
max_capacity=${a_memory_item[3]}
else
max_capacity='N/A'
fi
if [[ -n ${a_memory_item[6]} ]];then
error_correction=${a_memory_item[6]}
else
error_correction='N/A'
fi
memory_line="${C1}Array$SEP3${C2} $array_counter ${C1}capacity$SEP3${C2} $max_capacity ${C1}devices$SEP3${C2} $nu_of_devices ${C1}EC$SEP3${C2} $error_correction"
(( array_counter++ ))
else
# not used for now
if [[ -n ${a_memory_item[3333]} ]];then
if [[ -z ${a_memory_item[3]/BANK*/} ]];then
#bank=${a_memory_item[3]#BANK}
bank=${a_memory_item[3]}
bank=${bank## }
else
bank=${a_memory_item[3]}
fi
else
bank='N/A'
fi
# not used for now
if [[ -n ${a_memory_item[44444]} ]];then
if [[ -z ${a_memory_item[4]/SLOT*/} ]];then
#slot=${a_memory_item[4]#SLOT}
slot=${a_memory_item[4]}
slot=${slot## }
else
slot=${a_memory_item[4]}
fi
else
slot='N/A'
fi
if [[ -n ${a_memory_item[15]} ]];then
locator=${a_memory_item[15]}
locator=${locator## }
else
locator='N/A'
fi
if [[ -n ${a_memory_item[2]} ]];then
device_size=${a_memory_item[2]}
if [[ $device_size == 'No Module Installed' ]];then
b_module_present='false'
else
b_module_present='true'
fi
else
device_size='N/A'
fi
if [[ -n ${a_memory_item[6]} ]];then
device_type=${a_memory_item[6]}
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' && -n ${a_memory_item[7]} \
&& ${a_memory_item[7]} != 'Other' ]];then
device_type="$device_type (${a_memory_item[7]}) "
fi
else
device_type='N/A '
fi
device_type="${C1}type$SEP3${C2} $device_type "
if [[ -n ${a_memory_item[8]} ]];then
if [[ -n ${a_memory_item[9]} ]];then
device_speed=${a_memory_item[9]}
else
device_speed=${a_memory_item[8]}
fi
else
device_speed='N/A'
fi
if [[ $b_module_present == 'true' ]];then
device_speed="${C1}speed$SEP3${C2} $device_speed "
else
device_speed=''
fi
# memory-device,0x002C,8192 MB,ChannelD,ChannelD_Dimm2,DIMM,DDR3,Synchronous,2400 MHz,2400 MHz,64 bits,64 bits,Undefined,F3-19200C10-8GBZH,00000000
if [[ $b_module_present == 'true' ]];then
if [[ $B_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[13]} ]];then
part_nu=${a_memory_item[13]}
else
part_nu='N/A'
fi
part_nu="${C1}part$SEP3${C2} $part_nu "
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[12]} ]];then
manufacturer=${a_memory_item[12]}
else
manufacturer='N/A'
fi
manufacturer="${C1}manufacturer$SEP3${C2} $manufacturer "
if [[ -n ${a_memory_item[14]} ]];then
serial_nu=${a_memory_item[14]}
else
serial_nu='N/A'
fi
serial_nu="${C1}serial$SEP3${C2} $serial_nu "
fi
fi
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ $b_module_present == 'true' ]] || \
[[ -n ${a_memory_item[11]} || -n ${a_memory_item[10]} ]];then
if [[ -n ${a_memory_item[11]} ]];then
data_width=${a_memory_item[11]}
else
data_width='N/A'
fi
data_width="${C1}width$SEP3 total$SEP3${C2} $data_width "
if [[ -n ${a_memory_item[10]} ]];then
total_width=${a_memory_item[10]}
else
total_width='N/A'
fi
total_width="${C1}data$SEP3${C2} $total_width "
fi
fi
memory_line="${C1}Locator$SEP3${C2} $locator ${C1}size$SEP3${C2} $device_size $device_speed"
if [[ $( calculate_line_length "$memory_line$device_type" ) -le $COLS_INNER ]];then
memory_line="$memory_line$device_type"
device_type=''
fi
line_3="$manufacturer$part_nu$serial_nu"
line_2="$device_type$data_width$total_width"
# echo $( calculate_line_length "$memory_line" )
# echo $( calculate_line_length "$memory_line$line_2" )
if [[ $( calculate_line_length "$memory_line$line_2$line_3" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_2"
line_starter=' '
if [[ -n $line_3 && $( calculate_line_length "$memory_line$line_3" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_3"
else
memory_line="$line_2$line_3"
fi
else
memory_line="$memory_line$line_2$line_3"
fi
fi
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
line_starter=' '
done
memory_line=' '
fi
else
memory_line="${C2}$dmidecodeNull"
fi
IFS="$ORIGINAL_IFS"
memory_line=${memory_line## }
if [[ -n $memory_line ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
fi
eval $LOGFE
}
# currently only apt using distros support this feature, but over time we can add others
print_repo_data()
{