bsd fixes, for null drive data

This commit is contained in:
inxi-svn 2014-09-23 02:37:10 +00:00
parent ab8fa3f375
commit dedb8d5fa7

175
inxi
View file

@ -11538,7 +11538,6 @@ 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='' dev_string='/dev/'
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name=''
@ -11553,7 +11552,7 @@ print_hard_disk_data()
IFS="$ORIGINAL_IFS"
local hdd_capacity="${a_hdd_basic_working[0]}"
local hdd_used=${a_hdd_basic_working[1]}
local bsd_unsupported='Hard drive data not yet supported for BSD systems.'
local bsd_error="No HDD Info. $FILE_DMESG_BOOT not readable?"
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
@ -11564,112 +11563,110 @@ print_hard_disk_data()
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
get_hard_drive_data_advanced
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
do
# this adds the (x) numbering in front of each disk found, and creates the full disk string
IFS=","
a_hdd_working=( ${A_HDD_DATA[i]} )
IFS="$ORIGINAL_IFS"
if [[ $B_SHOW_DISK == 'true' ]];then
if [[ -n ${a_hdd_working[3]} ]];then
usb_data="${a_hdd_working[3]} "
else
usb_data=''
fi
size_data=" ${C1}size$SEP3${C2} ${a_hdd_working[1]}"
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"
# temporary message to indicate not yet supported
if [[ $BSD_TYPE == 'bsd' && -z $Dmesg_Boot_Data ]];then
hdd_data=$bsd_error
hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
print_screen_output "$hdd_data"
Line_Starter=' '
else
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
do
# this adds the (x) numbering in front of each disk found, and creates the full disk string
IFS=","
a_hdd_working=( ${A_HDD_DATA[i]} )
IFS="$ORIGINAL_IFS"
if [[ $B_SHOW_DISK == 'true' ]];then
if [[ -n ${a_hdd_working[3]} ]];then
usb_data="${a_hdd_working[3]} "
else
hdd_temp_data=''
usb_data=''
fi
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
hdd_serial=${a_hdd_working[4]}
if [[ -z $hdd_serial ]];then
hdd_serial='N/A'
size_data=" ${C1}size$SEP3${C2} ${a_hdd_working[1]}"
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"
else
hdd_temp_data=''
fi
fi
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
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_string${a_hdd_working[0]} "
fi
dev_data="$dev_string${a_hdd_working[0]} "
fi
if [[ -n ${a_hdd_working[2]} ]];then
hdd_name_temp=${a_hdd_working[2]}
else
hdd_name_temp='N/A'
fi
# echo "loop: $i"
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
hdd_string="${C1}ID-$((i+1))$SEP3${C2} $usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
part_1_data="$hdd_model$hdd_string "
if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter" )
print_screen_output "$hdd_data"
#echo 0
Line_Starter=' '
row_starter=''
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 1
if [[ -n ${a_hdd_working[2]} ]];then
hdd_name_temp=${a_hdd_working[2]}
else
hdd_name_temp='N/A'
fi
# echo "loop: $i"
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
hdd_string="${C1}ID-$((i+1))$SEP3${C2} $usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
part_1_data="$hdd_model$hdd_string "
if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter" )
print_screen_output "$hdd_data"
#echo 0
Line_Starter=' '
row_starter=''
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 1
else
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
Line_Starter=' '
row_starter=''
part_1_data=''
#echo 2
fi
fi
if [[ $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then
if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_2_data ) ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_2_data=''
fi
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
Line_Starter=' '
row_starter=''
part_1_data=''
#echo 2
fi
fi
if [[ $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then
if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_2_data ) ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data" )
#echo 4
elif [[ -n $part_2_data && \
$( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data$part_1_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_1_data=''
part_2_data=''
else
part_2_data=$part_1_data
fi
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
done
# then print any leftover items
if [[ -n $part_2_data ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 4
elif [[ -n $part_2_data && \
$( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data$part_1_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_1_data=''
part_2_data=''
else
part_2_data=$part_1_data
#echo 5
fi
done
# then print any leftover items
if [[ -n $part_2_data ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
print_screen_output "$hdd_data"
#echo 5
fi
# temporary message to indicate not yet supported
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"
Line_Starter=' '
fi
else
# temporary message to indicate not yet supported
hdd_data="$row_starter"
if [[ $b_bsd_debugger == 'false' && $BSD_TYPE == 'bsd' ]];then
hdd_data=$bsd_unsupported
fi
hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
print_screen_output "$hdd_data"
Line_Starter=' '