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() print_hard_disk_data()
{ {
eval $LOGFS eval $LOGFS
local b_bsd_debugger='true'
local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string='' local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string=''
local hdd_serial='' dev_string='/dev/' local hdd_serial='' dev_string='/dev/'
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name=''
@ -11553,7 +11552,7 @@ print_hard_disk_data()
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
local hdd_capacity="${a_hdd_basic_working[0]}" local hdd_capacity="${a_hdd_basic_working[0]}"
local hdd_used=${a_hdd_basic_working[1]} 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 hdd_name_temp='' part_1_data='' part_2_data=''
local row_starter="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) " local row_starter="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) "
# in bsd, /dev/wd0c is disk id # 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 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 ## note: the output part of this should be in the print hdd data function, not here
get_hard_drive_data_advanced get_hard_drive_data_advanced
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
do # temporary message to indicate not yet supported
# this adds the (x) numbering in front of each disk found, and creates the full disk string if [[ $BSD_TYPE == 'bsd' && -z $Dmesg_Boot_Data ]];then
IFS="," hdd_data=$bsd_error
a_hdd_working=( ${A_HDD_DATA[i]} ) hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
IFS="$ORIGINAL_IFS" print_screen_output "$hdd_data"
if [[ $B_SHOW_DISK == 'true' ]];then Line_Starter=' '
if [[ -n ${a_hdd_working[3]} ]];then else
usb_data="${a_hdd_working[3]} " for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
else do
usb_data='' # this adds the (x) numbering in front of each disk found, and creates the full disk string
fi IFS=","
size_data=" ${C1}size$SEP3${C2} ${a_hdd_working[1]}" a_hdd_working=( ${A_HDD_DATA[i]} )
if [[ $B_EXTRA_DATA == 'true' ]];then IFS="$ORIGINAL_IFS"
hdd_temp_data=${a_hdd_working[5]} if [[ $B_SHOW_DISK == 'true' ]];then
# error handling is done in get data function if [[ -n ${a_hdd_working[3]} ]];then
if [[ -n $hdd_temp_data ]];then usb_data="${a_hdd_working[3]} "
hdd_temp_data=" ${C1}temp$SEP3${C2} ${hdd_temp_data}C"
else else
hdd_temp_data='' usb_data=''
fi fi
fi size_data=" ${C1}size$SEP3${C2} ${a_hdd_working[1]}"
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $B_EXTRA_DATA == 'true' ]];then
hdd_serial=${a_hdd_working[4]} hdd_temp_data=${a_hdd_working[5]}
if [[ -z $hdd_serial ]];then # error handling is done in get data function
hdd_serial='N/A' if [[ -n $hdd_temp_data ]];then
hdd_temp_data=" ${C1}temp$SEP3${C2} ${hdd_temp_data}C"
else
hdd_temp_data=''
fi
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 fi
dev_data="$dev_string${a_hdd_working[0]} " if [[ -n ${a_hdd_working[2]} ]];then
fi hdd_name_temp=${a_hdd_working[2]}
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 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" ) hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
Line_Starter=' '
row_starter=''
part_1_data='' part_1_data=''
#echo 2 #echo 4
fi elif [[ -n $part_2_data && \
fi $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
if [[ $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data$part_1_data" )
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" print_screen_output "$hdd_data"
#echo 3 #echo 3
Line_Starter=' ' Line_Starter=' '
row_starter='' row_starter=''
part_1_data=''
part_2_data='' part_2_data=''
else
part_2_data=$part_1_data
fi 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" print_screen_output "$hdd_data"
part_1_data='' #echo 5
#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 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 fi
else else
# temporary message to indicate not yet supported
hdd_data="$row_starter" 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" ) hdd_data=$( create_print_line "$Line_Starter" "$hdd_data" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
Line_Starter=' ' Line_Starter=' '