branch one, updated inxi

This commit is contained in:
inxi-svn 2014-09-22 02:43:25 +00:00
parent 8c366d4cc3
commit 6f83ed621d

412
inxi
View file

@ -3,9 +3,9 @@
# openbsd ftp does http
########################################################################
#### Script Name: inxi
#### Version: 2.2.5
#### Date: 2014-09-17
#### Patch Number: 05-b1
#### Version: 2.2.8
#### Date: 2014-09-21
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
########################################################################
@ -274,6 +274,7 @@ A_DISPLAY_SERVER_DATA=''
### BOOLEANS ###
## standard boolean flags ##
B_BSD_DISK_SET='false'
B_BSD_RAID='false'
B_COLOR_SCHEME_SET='false'
B_CONSOLE_IRC='false'
@ -798,7 +799,7 @@ initialize_data()
eval $LOGFS
BSD_VERSION=$( uname -s 2>/dev/null | tr '[A-Z]' '[a-z]' )
# note: archbsd says they are a freebsd distro, so assuming it's the same as freebsd
if [[ -z ${BSD_VERSION/*bsd*/} || -z ${BSD_VERSION/*darwin*/} ]];then
if [[ -z ${BSD_VERSION/*bsd*/} || -z ${BSD_VERSION/*dragonfly*/} || -z ${BSD_VERSION/*darwin*/} ]];then
if [[ -z ${BSD_VERSION/*openbsd*/} ]];then
BSD_VERSION='openbsd'
elif [[ -z ${BSD_VERSION/*darwin*/} ]];then
@ -827,11 +828,11 @@ initialize_data()
initialize_paths
# set downloaders.
if [[ -z $( type -p wget ) ]];then
if ! type -p wget &>/dev/null;then
# first check for bsd stuff
if [[ -n $( type -p fetch ) ]];then
if type -p fetch &>/dev/null;then
DOWNLOADER='fetch'
elif -n $( type -p curl ) ]];then
elif type -p curl &>/dev/null;then
DOWNLOADER='curl'
elif [[ $BSD_VERSION == 'openbsd' && -n $( type -p ftp ) ]];then
DOWNLOADER='ftp'
@ -1640,7 +1641,7 @@ debug_data_collector()
host="-no-host"
fi
if [[ -n $BSD_TYPE ]];then
bsd_string="-$BSD_TYPE"
bsd_string="-$BSD_TYPE-$BSD_VERSION"
fi
if [[ $( whoami ) == 'root' ]];then
root_string='-root'
@ -1890,7 +1891,7 @@ debug_data_collector()
gpart list &> $debug_data_dir/bsd-gpart-list.txt
gpart show &> $debug_data_dir/bsd-gpart-show.txt
gpart status &> $debug_data_dir/bsd-gpart-status.txt
swapctl -l &> $debug_data_dir/bsd-swapctl-l.txt
swapctl -l -k &> $debug_data_dir/bsd-swapctl-l-k.txt
swapon -s &> $debug_data_dir/swapon-s.txt
sysctl -b kern.geom.conftxt &> $debug_data_dir/bsd-sysctl-b-kern.geom.conftxt.txt
sysctl -b kern.geom.confxml &> $debug_data_dir/bsd-sysctl-b-kern.geom.confxml.txt
@ -3664,7 +3665,7 @@ get_audio_usb_data()
lsusb_data=$( lsusb 2>/dev/null )
fi
log_function_data 'raw' "usb_data:\n$lsusb_data"
if [[ -n $lsusb_data ]];then
if [[ -n $lsusb_data && -d /proc/asound/ ]];then
# for every sound card symlink in /proc/asound - display information about it
for usb_proc_file in /proc/asound/*
do
@ -4079,15 +4080,15 @@ get_cpu_data_bsd()
sub(/[[:space:]]*\(.*\)$/,"",$NF)
}
cpuModel=$NF
if ( cpuClock != "" ) {
exit
}
# if ( cpuClock != "" ) {
# exit
# }
}
/^hw.clock/ {
cpuClock=$NF
if ( cpuModel != "" ) {
exit
}
# if ( cpuModel != "" ) {
# exit
# }
}
/^hw.cpufrequency/ {
cpuClock = $NF / 1000000
@ -4102,6 +4103,15 @@ get_cpu_data_bsd()
/^machdep.cpu.vendor/ {
cpuVendor=$NF
}
# Freebsd does some voltage hacking to actually run at lowest listed frequencies.
# The cpu does not actually support all the speeds output here but works in freebsd.
/^dev.cpu.0.freq_levels/ {
gsub(/^[[:space:]]+|\/[0-9]+|[[:space:]]+$/,"",$NF)
if ( $NF ~ /[0-9]+[[:space:]]+[0-9]+/ ) {
min=gensub(/.*[[:space:]]([0-9]+)$/,"\\1",1,$NF)
max=gensub(/^([0-9]+)[[:space:]].*/,"\\1",1,$NF)
}
}
/^machdep.cpu.brand_string/ {
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
gsub(/'"$BAN_LIST_CPU"'/, "", $NF )
@ -4113,12 +4123,15 @@ get_cpu_data_bsd()
cpuModel=$NF
}
END {
if ( cpuMax != "" ) {
if ( max == 0 && cpuMax != "" ) {
max=cpuMax
}
if ( cpuClock == "" ) {
cpuClock="N/A"
}
sub(/\.[0-9]+/,"",cpuClock)
sub(/\.[0-9]+/,"",min)
sub(/\.[0-9]+/,"",max)
print cpuModel "," cpuClock "," cpuCache "," cpuFlags "," cpuBogomips "," cpuVendor
# triggers print case
print cpuClock "," min "," max
@ -4137,14 +4150,14 @@ get_cpu_flags_bsd()
local gawk_fs=':'
if [[ -n $Dmesg_Boot_Data ]];then
cpu_flags=$( gawk -v bsdVersion=$BSD_VERSION -F ":" '
cpu_flags=$( gawk -v bsdVersion="$BSD_VERSION" -F ":" '
BEGIN {
IGNORECASE=1
cpuFlags=""
}
/^(CPU:|cpu0:)/ {
while ( getline && !/memory|real mem/ ) {
if ( $1 ~ /Features/ || ( bsdVersion == "openbsd" && $0 ~ /^cpu0.*,[a-z][a-z][a-z],[a-z][a-z][a-z],/ ) ) {
if ( $1 ~ /Features/ || ( bsdVersion == "openbsd" && $0 ~ /^cpu0.*[[:space:]][a-z][a-z][a-z][[:space:]][a-z][a-z][a-z][[:space:]]/ ) ) {
# clean up odd stuff like <b23>
gsub(/<[a-z0-9]+>/,"", $2)
# all the flags are contained within < ... > on freebsd at least
@ -4159,7 +4172,7 @@ get_cpu_flags_bsd()
}' <<< "$Dmesg_Boot_Data" )
elif [[ -n $Sysctl_a_Data ]];then
if [[ $BSD_VERSION == 'openbsd' ]];then
gawk_fs='='
gawk_fs=':'
fi
cpu_flags=$( gawk -F "$gawk_fs" '
BEGIN {
@ -4398,6 +4411,22 @@ get_desktop_environment()
fi
fi
desktop_environment="Unity"
elif [[ $XDG_CURRENT_DESKTOP == 'LXQt' ]];then
# if type -p lxqt-about &>/dev/null;then
# version=$( get_program_version 'lxqt-about' '^lxqt-about' '2' )
# fi
if [[ $B_EXTRA_DATA == 'true' ]];then
if kded$KDE_SESSION_VERSION &>/dev/null;then
version_data=$( kded$KDE_SESSION_VERSION --version 2>/dev/null )
toolkit=$( grep -si '^Qt:' <<< "$version_data" | gawk '{print $2}' )
elif type -p qtdiag &>/dev/null;then
toolkit=$( get_program_version 'qtdiag' '^qt' '2' )
fi
if [[ -n $toolkit ]];then
version="$version (Qt $toolkit)"
fi
fi
desktop_environment='LXQt'
fi
# did we find it? If not, start the xprop tests
if [[ -z $desktop_environment ]];then
@ -4742,6 +4771,7 @@ get_de_gtk_data()
eval $LOGFE
}
# see which dm has started if any
get_display_manager()
{
@ -5205,7 +5235,14 @@ get_dmesg_boot_data()
# replace all indented items with ~ so we can id them easily while processing
# note that if user, may get error of read permissions
# for some weird reason, real mem and avail mem are use a '=' separator, who knows why, the others are ':'
dmsg_boot_data="$( cat $FILE_DMESG_BOOT 2>/dev/null | sed -e 's/"//g' -e 's/[[:space:]]*=[[:space:]]*/:/g' -e 's/:[[:space:]]*/:/g' )"
dmsg_boot_data="$( cat $FILE_DMESG_BOOT 2>/dev/null | gawk '
{
sub(/[[:space:]]*=[[:space:]]*|:[[:space:]]*/,":", $0)
gsub(/,/," ", $0)
gsub(/\"/, "", $0)
gsub(/[[:space:]][[:space:]]/, " ", $0)
print $0
}' )"
fi
echo "$dmsg_boot_data"
# log_function_data "$dmsg_boot_data"
@ -5755,8 +5792,8 @@ get_hdd_data_basic()
else
df_string='df -k'
fi
if swapctl -l &>/dev/null;then
swap_size=$( swapctl -l 2>/dev/null | gawk '
if swapctl -l -k &>/dev/null;then
swap_size=$( swapctl -l -k 2>/dev/null | gawk '
BEGIN {
swapSize=0
total=0
@ -5774,7 +5811,7 @@ get_hdd_data_basic()
hdd_data="$( eval $df_string )"
# eval $df_string | awk 'BEGIN{tot=0} !/total/ {tot+=$4} END{print tot}'
log_function_data 'raw' "hdd_data:\n$hdd_data"
hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE -v swapSize=$swap_size '
hdd_used=$( echo "$hdd_data" | gawk -v bsdType="$BSD_TYPE" -v swapSize="$swap_size" '
BEGIN {
# this is used for specific cases where bind, or incorrect multiple mounts to same partitions,
# is present. The value is searched for an earlier appearance of that partition and if it is
@ -5795,7 +5832,7 @@ get_hdd_data_basic()
# note that linux 3.2.45-grsec-9th types kernels have this type of partition name: /dev/xvdc (no number, letter)
# note: btrfs does not seem to use partition integers, just the primary /dev/sdx identifier
# df can also show /dev/disk/(by-label|by-uuid etc)
/^\/dev\/(disk\/|mapper\/|[hsv]d[a-z][0-9]*|dm[-]?[0-9]+|ada[0-9]+p[0-9]+.*|md[0-9]+|[aw]d[0-9]+s.*|xvd[a-z])/ {
/^\/dev\/(disk\/|mapper\/|[hsv]d[a-z][0-9]*|dm[-]?[0-9]+|ada[0-9]+p[0-9]+.*|(ad|sd|wd)[0-9]+[a-z]|md[0-9]+|[aw]d[0-9]+s.*|xvd[a-z])/ {
# this handles the case where the first item is too long
# and makes df wrap output to next line, so here we advance
# it to the next line for that single case. Using df -P should
@ -5875,19 +5912,29 @@ get_hdd_data_basic()
# this handles a special case with livecds where no hdd_used is detected
if ( size > 0 && hddUsed == "na" ) {
size = sprintf( "%.1f", size )
print size "GB,-"
print size "GB,-,,.."
}
else if ( size > 0 && workingUsed > 0 ) {
diskUsed = workingUsed*100/size # calculate used percentage
diskUsed = sprintf( "%.1f", diskUsed )
if ( int(diskUsed) > 100 ) {
diskUsed = "Used Error!"
}
else {
diskUsed = diskUsed "% used"
}
size = sprintf( "%.1f", size )
print size "GB," diskUsed "% used"
print size "GB," diskUsed ",,.."
}
else {
print "NA,-" # print an empty array, this will be further handled in the print out function
print "NA,-,,.." # print an empty array, this will be further handled in the print out function
}
}' $FILE_PARTITIONS ) )
log_function_data 'cat' "$FILE_PARTITIONS"
else
if [[ -n $BSD_TYPE ]];then
get_hard_drive_data_bsd "$hdd_used"
fi
fi
IFS="$ORIGINAL_IFS"
a_temp=${A_HDD_DATA[@]}
@ -5902,7 +5949,7 @@ get_hard_drive_data_advanced()
eval $LOGFS
local a_temp_working='' a_temp_scsi='' temp_holder='' temp_name='' i='' j=''
local sd_ls_by_id='' ls_disk_by_id='' ls_disk_by_path='' usb_exists='' a_temp=''
local firewire_exists='' thunderbolt_exists='' thunderbolt_exists=''
local firewire_exists='' thunderbolt_exists='' thunderbolt_exists='' hdd_temp hdd_serial=''
## check for all ide type drives, non libata, only do it if hdx is in array
## this is now being updated for new /sys type paths, this may handle that ok too
@ -6036,14 +6083,129 @@ get_hard_drive_data_advanced()
fi
done
fi
if [[ $B_EXTRA_DATA == 'true' ]];then
IFS=","
a_temp_working=( ${A_HDD_DATA[i]} )
# echo "a:" ${a_temp_working[@]}
IFS="$ORIGINAL_IFS"
hdd_temp=''
hdd_serial=''
if [[ -n ${a_temp_working[1]} ]];then
hdd_temp=$( get_hdd_temp_data "/dev/${a_temp_working[0]}" )
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
hdd_serial=$( get_hdd_serial_number "${a_temp_working[0]}" )
fi
A_HDD_DATA[i]="${a_temp_working[0]},${a_temp_working[1]},${a_temp_working[2]},${a_temp_working[3]},$hdd_serial,$hdd_temp"
# echo b: ${A_HDD_DATA[i]}
fi
done
unset ls_disk_by_id # and then let's dump the data we don't need
fi
a_temp=${A_HDD_DATA[@]}
log_function_data "A_HDD_DATA: $a_temp"
eval $LOGFE
}
# args: $1 ~ hdd_used
get_hard_drive_data_bsd()
{
eval $LOGFS
local a_temp=''
if [[ -n $Dmesg_Boot_Data ]];then
IFS=$'\n'
A_HDD_DATA=( $( gawk -v hddUsed="$1" -F ':' '
BEGIN {
IGNORECASE=1
size=0
bSetSize="false"
}
$1 ~ /^(ad|ada|sd|wd)[0-9]+(|[[:space:]]at.*)$/ {
diskId=gensub(/^((ad|ada|sd|wd)[0-9]+)[^0-9].*/,"\\1",1,$1)
# note: /var/run/dmesg.boot may repeat items since it is not created
# fresh every boot, this way, only the last items will be used per disk id
if (aIds[diskId] == "" ) {
aIds[diskId]=diskId
if ( $0 !~ /raid/) {
bSetSize="true"
}
}
aDisks[diskId, "id"] = diskId
if ($0 ~ /[^0-9][0-9\.]+[[:space:]]*[MG]B/ && $0 !~ /MB\/s/) {
workingSize=gensub(/.*[^0-9]([0-9\.]+[[:space:]]*[MG]B).*/,"\\1",1,$0)
if (workingSize ~ /GB/ ) {
sub(/[[:space:]]*GB/,"",workingSize)
workingSize=workingSize*1000
}
else if (workingSize ~ /MB/ ) {
sub(/[[:space:]]*MB/,"",workingSize)
workingSize=workingSize
}
aDisks[diskId, "size"] = workingSize
if ( bSetSize == "true" ) {
if ( workingSize != "" ){
size=size+workingSize
bSetSize="false"
}
}
}
if ( $NF ~ /<.*>/ ){
gsub(/.*<|>.*/,"",$NF)
aDisks[diskId, "model"] = $NF
}
if ( $NF ~ /serial number/ ){
sub(/serial[[:space:]]+number[[:space:]]*/,"",$NF)
aDisks[diskId, "serial"] = $NF
}
}
END {
# sde,3.9GB,STORE_N_GO,USB,C200431546D3CF49-0:0,0
# sdd,250.1GB,ST3250824AS,,9ND08GKX,45
for ( key in aIds ) {
# we are not adding to size above for raid, and we do not print it for raid
# this is re openbsd raid, which uses sd0 for raid array, even though sd is for scsi
if ( aDisks[aIds[key], "model"] !~ /raid/ ) {
workingSize = aDisks[aIds[key], "size"]/1000
workingSize = sprintf( "%.1fGB", workingSize )
print aDisks[aIds[key], "id"] "," workingSize "," aDisks[aIds[key], "model"] "," "," aDisks[aIds[key], "serial"] ","
}
}
size = size/1000 # calculate size in GB size
# in kb
workingUsed = hddUsed*1024/1000**3 # calculate workingUsed in GB used
# this handles a special case with livecds where no hdd_used is detected
if ( size > 0 && hddUsed == "na" ) {
size = sprintf( "%.1f", size )
print size "GB,-,,.."
}
else if ( size > 0 && workingUsed > 0 ) {
diskUsed = workingUsed*100/size # calculate used percentage
diskUsed = sprintf( "%.1f", diskUsed )
if ( int(diskUsed) > 100 ) {
diskUsed = "Used Error!"
}
else {
diskUsed = diskUsed "% used"
}
size = sprintf( "%.1f", size )
print size "GB," diskUsed ",,.."
}
else {
print "NA,-,,.." # print an empty array, this will be further handled in the print out function
}
}' <<< "$Dmesg_Boot_Data" ) )
IFS="$ORIGINAL_IFS"
fi
a_temp=${A_HDD_DATA[@]}
# echo ${a_temp[@]}
log_function_data "A_HDD_DATA: $a_temp"
eval $LOGFE
}
# args: $1 - which drive to get serial number of
get_hdd_serial_number()
{
@ -6664,7 +6826,9 @@ get_networking_data()
IFS="$ORIGINAL_IFS"
get_networking_usb_data
if [[ $B_SHOW_ADVANCED_NETWORK == 'true' || $B_USB_NETWORKING == 'true' ]];then
get_network_advanced_data
if [[ -z $BSD_TYPE ]];then
get_network_advanced_data
fi
fi
a_temp=${A_NETWORK_DATA[@]}
log_function_data "A_NETWORK_DATA: $a_temp"
@ -7096,11 +7260,7 @@ get_optical_drive_data()
local a_temp='' sys_uevent_path='' proc_cdrom='' link_list=''
local separator='' linked='' working_disk='' disk='' item_string='' proc_info_string=''
local dev_disks_full=''
if [[ $BSD_TYPE != 'bsd' ]];then
dev_disks_full="$( ls /dev/dvd* /dev/cd* /dev/scd* /dev/sr* 2>/dev/null | grep -vE 'random' )"
else
dev_disks_full="$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )"
fi
dev_disks_full="$( ls /dev/dvd* /dev/cd* /dev/scd* /dev/sr* 2>/dev/null | grep -vE 'random' )"
## Not using this now because newer kernel is NOT linking all optical drives. Some, but not all
# Some systems don't support xargs -L plus the unlinked optical drive unit make this not a good option
# get the actual disk dev location, first try default which is easier to run, need to preserve line breaks
@ -7275,6 +7435,67 @@ get_optical_drive_data()
}
# get_optical_drive_data;exit
get_optical_drive_data_bsd()
{
eval $LOGFS
local a_temp=''
if [[ -n $Dmesg_Boot_Data ]];then
IFS=$'\n'
A_OPTICAL_DRIVE_DATA=( $( gawk -F ':' '
BEGIN {
IGNORECASE=1
}
# sde,3.9GB,STORE_N_GO,USB,C200431546D3CF49-0:0,0
# sdd,250.1GB,ST3250824AS,,9ND08GKX,45
$1 ~ /^(cd|dvd)[0-9]+/ {
diskId=gensub(/^((cd|dvd)[0-9]+)[^0-9].*/,"\\1",1,$1)
# note: /var/run/dmesg.boot may repeat items since it is not created
# fresh every boot, this way, only the last items will be used per disk id
if (aIds[diskId] == "" ) {
aIds[diskId]=diskId
}
aDisks[diskId, "id"] = diskId
if ( $NF ~ /<.*>/ ){
gsub(/.*<|>.*/,"",$NF)
rev_number=gensub(/.*[^0-9\.]([0-9\.]+)$/,"\\1",1,$NF)
if (rev_number ~ /^[0-9\.]+$/) {
aDisks[diskId, "rev"] = rev_number
}
model=gensub(/(.*[^0-9\.])[0-9\.]+$/,"\\1",1,$NF)
sub(/[[:space:]]+$/,"",model)
aDisks[diskId, "model"] = model
}
if ( $NF ~ /serial number/ ){
sub(/serial[[:space:]]+number[[:space:]]*/,"",$NF)
aDisks[diskId, "serial"] = $NF
}
if ( $NF ~ /[GM]B\/s/ ){
speed=gensub(/^([0-9\.]+[[:space:]]*[GM]B\/s).*/,"\\1",1,$NF)
sub(/\.[0-9]+/,"",speed)
if ( speed ~ /^[0-9]+/ ) {
aDisks[diskId, "speed"] = speed
}
}
}
# "$link,dev-readlinks,$vendor,$model,$rev_number,$proc_info_string,$state"
# $proc_info_string: print speed "," multisession "," mcn "," audio "," cdr "," cdrw "," dvd "," dvdr "," dvdram
END {
for ( key in aIds ) {
print aDisks[aIds[key], "id"] ",,," aDisks[aIds[key], "model"] "," aDisks[aIds[key], "rev"] "," aDisks[aIds[key], "speed"] ",,,,,,,,"
}
}' <<< "$Dmesg_Boot_Data" ) )
IFS="$ORIGINAL_IFS"
fi
a_temp=${A_OPTICAL_DRIVE_DATA[@]}
# echo ${a_temp[@]}
log_function_data "A_OPTICAL_DRIVE_DATA: $a_temp"
eval $LOGFE
}
get_partition_data()
{
eval $LOGFS
@ -7291,7 +7512,7 @@ get_partition_data()
--exclude-type=fdescfs --exclude-type=iso9660 --exclude-type=linprocfs --exclude-type=procfs
--exclude-type=squashfs --exclude-type=sysfs --exclude-type=tmpfs --exclude-type=unionfs'
else
swap_data="$( swapctl -l 2>/dev/null )"
swap_data="$( swapctl -l -k 2>/dev/null )"
# default size is 512, -H only for size in human readable format
# older bsds don't support -T, pain, so we'll use partial output there
if df -h -T &>/dev/null;then
@ -7320,7 +7541,7 @@ get_partition_data()
# $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used
## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if
## the first field is too long, it will occupy its own line, this way we are getting only the needed data
A_PARTITION_DATA=( $( echo "$main_partition_data" | gawk -v bsdType=$BSD_TYPE -v bsdVersion=$BSD_VERSION '
A_PARTITION_DATA=( $( echo "$main_partition_data" | gawk -v bsdType="$BSD_TYPE" -v bsdVersion="$BSD_VERSION" '
BEGIN {
IGNORECASE=1
fileSystem=""
@ -7332,7 +7553,7 @@ get_partition_data()
( bsdType != "" ) {
# skip if non disk/partition, or if raid primary id, which will not have a / in it
if ( $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|iso9660|linprocfs|procfs|squashfs|sysfs|tmpfs|type|unionfs)$/ ||
$1 ~ /^([^\/]+)$/ ) {
( $1 ~ /^([^\/]+)$/ && $1 !~ /^ROOT/ ) ) {
# note use next, not getline or it does not work right
next
}
@ -7467,7 +7688,7 @@ get_partition_data()
# older bsds have df minus -T so can't get fs type easily, try using mount instead
if [[ $BSD_TYPE == 'bsd' ]] && [[ -z $fs_type && -n $dev_item ]];then
dev_bsd_item=$( sed -e 's/non-dev-//' -e 's|/|\\/|g' <<< "$dev_item" )
fs_type=$( gawk -v bsdVersion=$BSD_VERSION -F '(' '
fs_type=$( gawk -v bsdVersion="$BSD_VERSION" -F '(' '
BEGIN {
IGNORECASE=1
fileSystem=""
@ -7874,13 +8095,13 @@ EOF"
sub(/:$/, "", pciId)
itemData=$4
chipId=gensub(/.*chip=([0-9a-f][0-9a-f][0-9a-f][0-9a-f])([0-9a-f][0-9a-f][0-9a-f][0-9a-f]).*/, "\\2:\\1", itemData )
if ( $2 ~ /class=020000|class=0x068000/ ) {
if ( $2 ~ /class=020000|class=068000/ ) {
class="network"
}
else if ( $2 == "class=030000" ) {
class="display"
}
else if ( $2 == "class=040300" ) {
else if ( $2 ~ /class=040300|class=040100/ ) {
class="audio"
}
@ -8261,6 +8482,7 @@ get_raid_data_bsd()
A_RAID_DATA=( $(
gawk '
BEGIN {
IGNORECASE=1
raidString=""
separator=""
components=""
@ -8271,6 +8493,7 @@ get_raid_data_bsd()
/SIZE.*ALLOC/ {
sub(/.*ALLOC.*/,"", $0)
}
# gptid/d874c7e7-3f6d-11e4-b7dc-080027ea466c
/^[^[:space:]]/ {
components=""
separator=""
@ -8281,10 +8504,17 @@ get_raid_data_bsd()
blocksAvailable=$4
chunkRaidAllocated=$3
# go to the next line now, this will probably need fixing later with weird data sets
getline
# raid level is the second item in the output, unless it is not, sometimes it is absent
if ( $1 != "" ) {
raidLevel="zfs " $1
if ( $1 ~ /raid|mirror/ ) {
raidLevel="zfs " $1
}
else {
raidLevel="zfs-no-raid"
components = $1
separator=" "
}
}
while ( getline && $1 !~ /^$/ ) {
@ -8292,7 +8522,8 @@ get_raid_data_bsd()
components = components separator $1
separator=" "
}
# some issues if we use ~ here
gsub(/\//,"%",components)
# print $1
raidString = device "," deviceState "," raidLevel "," components "," reportSize "," uData
raidString = raidString "," blocksAvailable "," superBlock "," algorithm "," chunkRaidAllocated
@ -8339,6 +8570,9 @@ get_raid_component_data_bsd()
IGNORECASE=1
separator=""
}
{
gsub(/\//,"%",$1)
}
$1 ~ /^'$component'$/ {
sub( /ONLINE/, "", $2 )
print "'$component'" $2
@ -8347,7 +8581,7 @@ get_raid_component_data_bsd()
component_string="$component_string$separator$component_status"
separator=' '
done
array_string="$device,${a_raid_data[1]},${a_raid_data[2]},$component_string,${a_raid_data[4]}"
array_string="$device,${a_raid_data[1]},${a_raid_data[2]},${component_string//%/\/},${a_raid_data[4]}"
array_string="$array_string,${a_raid_data[5]},${a_raid_data[6]},${a_raid_data[7]},${a_raid_data[8]}"
array_string="$array_string,${a_raid_data[9]},${a_raid_data[10]},${a_raid_data[11]},${a_raid_data[12]},"
array_string="$array_string${a_raid_data[13]},${a_raid_data[14]},${a_raid_data[15]}"
@ -8361,10 +8595,17 @@ get_raid_component_data_bsd()
}
$1 ~ /^'$device'$/ {
while ( getline && !/^$/ ) {
# raid level is the second item in the output
if ( $1 != "" && raidLevel == "" ) {
raidLevel="zfs " $1
getline
# raid level is the second item in the output, unless it is not, sometimes it is absent
if ( $1 != "" ) {
if ( raidLevel == "" ) {
if ( $1 ~ /raid|mirror/ ) {
raidLevel="zfs " $1
getline
}
else {
raidLevel="zfs-no-raid"
}
}
}
sub( /ONLINE/, "", $2 )
components=components separator $1 separator $2
@ -10507,10 +10748,14 @@ print_audio_data()
local driver=''
# set A_AUDIO_DATA and get alsa data
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
if [[ $B_PCICONF == 'true' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
fi
get_pciconf_card_data 'audio'
elif [[ $B_LSPCI == 'true' ]];then
get_audio_data
fi
get_pciconf_card_data 'audio'
else
get_audio_data
fi
@ -10970,13 +11215,17 @@ print_graphics_data()
# this can contain a long No case debugging message, so it's being sliced off
# note: using grep -ioE '(No|Yes)' <<< ${A_GLX_DATA[2]} did not work in Arch, no idea why
local glx_direct_render=$( gawk '{print $1}' <<< "${A_GLX_DATA[2]}" )
# set A_GRAPHICS_CARD_DATA
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
if [[ $B_PCICONF == 'true' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
fi
get_pciconf_card_data 'display'
elif [[ $B_LSPCI == 'true' ]];then
get_graphics_card_data
fi
get_pciconf_card_data 'display'
else
get_graphics_card_data
fi
@ -11177,11 +11426,12 @@ print_graphics_data()
print_hard_disk_data()
{
eval $LOGFS
local b_bsd_debugger='true'
local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string=''
local hdd_serial=''
local hdd_serial='' dev_string='/dev/'
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name=''
local Line_Starter='Drives:' # inherited by print_optical_drives
# load A_HDD_DATA
# load A_HDD_DATA - this will also populate the full bsd disk data array values
get_hdd_data_basic
## note: if hdd_model is declared prior to use, whatever string you want inserted will
## be inserted first. In this case, it's desirable to print out (x) before each disk found.
@ -11194,6 +11444,10 @@ print_hard_disk_data()
local bsd_unsupported='Hard drive data not yet supported for BSD systems.'
local hdd_name_temp='' part_1_data='' part_2_data=''
local row_starter="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) "
# in bsd, /dev/wd0c is disk id
if [[ -n $BSD_TYPE ]];then
dev_string=''
fi
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
@ -11210,10 +11464,9 @@ print_hard_disk_data()
else
usb_data=''
fi
dev_data="/dev/${a_hdd_working[0]} "
size_data=" ${C1}size$SEP3${C2} ${a_hdd_working[1]}"
if [[ $B_EXTRA_DATA == 'true' && -n $dev_data ]];then
hdd_temp_data=$( get_hdd_temp_data "$dev_data" )
if [[ $B_EXTRA_DATA == 'true' ]];then
hdd_temp_data=${a_hdd_working[5]}
# error handling is done in get data function
if [[ -n $hdd_temp_data ]];then
hdd_temp_data=" ${C1}temp$SEP3${C2} ${hdd_temp_data}C"
@ -11222,13 +11475,13 @@ print_hard_disk_data()
fi
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
hdd_serial=$( get_hdd_serial_number "${a_hdd_working[0]}" )
hdd_serial=${a_hdd_working[4]}
if [[ -z $hdd_serial ]];then
hdd_serial='N/A'
fi
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
fi
dev_data="/dev/${a_hdd_working[0]} "
dev_data="$dev_string${a_hdd_working[0]} "
fi
if [[ -n ${a_hdd_working[2]} ]];then
hdd_name_temp=${a_hdd_working[2]}
@ -11293,7 +11546,7 @@ print_hard_disk_data()
#echo 5
fi
# temporary message to indicate not yet supported
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $b_bsd_debugger == 'false' && $BSD_TYPE == 'bsd' ]];then
hdd_data=$bsd_unsupported
hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
print_screen_output "$hdd_data"
@ -11302,7 +11555,7 @@ print_hard_disk_data()
else
# temporary message to indicate not yet supported
hdd_data="$row_starter"
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $b_bsd_debugger == 'false' && $BSD_TYPE == 'bsd' ]];then
hdd_data=$bsd_unsupported
fi
hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
@ -11664,12 +11917,17 @@ print_networking_data()
local card_string='' port_plural='' module_version='' pci_bus_id='' bus_usb_text=''
local bus_usb_id='' line_starter='Network:' card_string='' card_data='' chip_id=''
local driver='' part_2_data=''
# set A_NETWORK_DATA
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
if [[ $B_PCICONF == 'true' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
get_pciconf_data
fi
get_pciconf_card_data 'network'
elif [[ $B_LSPCI == 'true' ]];then
get_networking_data
fi
get_pciconf_card_data 'network'
else
get_networking_data
fi
@ -11930,10 +12188,16 @@ print_networking_ip_data()
print_optical_drive_data()
{
eval $LOGFS
local a_drives='' drive_data='' counter=''
local a_drives='' drive_data='' counter='' dev_string='/dev/' speed_string='x'
local drive_id='' drive_links='' vendor='' speed='' multisession='' mcn='' audio=''
local dvd='' state='' rw_support='' rev='' separator='' drive_string='' part_2_data=''
get_optical_drive_data
if [[ -z $BSD_TYPE ]];then
get_optical_drive_data
else
get_optical_drive_data_bsd
dev_string=''
speed_string=''
fi
# 0 - true dev path, ie, sr0, hdc
# 1 - dev links to true path
# 2 - device vendor - for hdx drives, vendor model are one string from proc
@ -11968,7 +12232,7 @@ print_optical_drive_data()
if [[ -z ${a_drives[0]} ]];then
drive_id='N/A'
else
drive_id="/dev/${a_drives[0]}"
drive_id="$dev_string${a_drives[0]}"
fi
drive_links=$( sed 's/~/,/g' <<< ${a_drives[1]} )
if [[ -z $drive_links ]];then
@ -12044,7 +12308,7 @@ print_optical_drive_data()
if [[ -z ${a_drives[5]} ]];then
speed='N/A'
else
speed="${a_drives[5]}x"
speed="${a_drives[5]}$speed_string"
fi
if [[ -z ${a_drives[8]} ]];then
audio='N/A'
@ -12464,7 +12728,7 @@ print_raid_data()
fi
if [[ ${a_raid_working[3]} == '' ]];then
if [[ ${a_raid_working[1]} != 'inactive' ]];then
device_components='N/A'
device_components=" ${C1}components$SEP3${C2} N/A"
fi
else
for component in ${a_raid_working[3]}