removed RAID line from -b output if either no /proc/mdstat file or if no raid devices detected. -b should always

be as short and non verbose as possible. Also noted in --help that -b does not show hard drive names, just totals.
This commit is contained in:
inxi-svn 2012-05-11 17:30:17 +00:00
parent 20cd60a6ad
commit 654694cd16

66
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.8.0
#### Date: May 10 2012
#### version: 1.8.1
#### Date: May 11 2012
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -2148,7 +2148,7 @@ show_options()
print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
print_screen_output "Output Control Options:"
print_screen_output "-A Show Audio/sound card information."
print_screen_output "-b Shows basic output, short form (previously -d). Same as: $SCRIPT_NAME -v 2"
print_screen_output "-b Shows basic output, short form. Same as: $SCRIPT_NAME -v 2 except only hard disk capacity/used shows."
print_screen_output "-c Available color schemes. Scheme number is required. Color selectors run a color selector option"
print_screen_output " prior to $SCRIPT_NAME starting which lets you set the config file value for the selection."
print_screen_output " Supported color schemes: 0-$color_scheme_count Example: $SCRIPT_NAME -c 11"
@ -7793,7 +7793,7 @@ print_raid_data()
local a_partition_working='' raid_data='' kernel_support='' read_ahead='' unused_devices=''
local basic_raid='' basic_raid_separator='' basic_raid_plural='' inactive=''
local component_separator='' device_id='' print_string='' loop_limit=0 array_count_unused=''
local array_count='' raid_event=''
local array_count='' raid_event='' b_print_lines='true'
get_raid_data
@ -8000,10 +8000,18 @@ print_raid_data()
fi
if [[ $B_MDSTAT_FILE != 'true' ]];then
a_raid_data[0]="${C1}Error${SEP3}${C2} No /proc/mdstat file detected!"
if [[ $B_SHOW_BASIC_RAID != 'true' ]];then
a_raid_data[0]="${C1}Error${SEP3}${C2} No /proc/mdstat file detected!"
else
b_print_lines='false'
fi
else
if [[ ${a_raid_data[0]} == '' ]];then
a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected!"
if [[ $B_SHOW_BASIC_RAID != 'true' ]];then
a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected!"
else
b_print_lines='false'
fi
fi
# now let's add on the system line and the unused device line. Only print on -xx
if [[ $kernel_support$read_ahead$raid_event != '' ]];then
@ -8017,31 +8025,33 @@ print_raid_data()
loop_limit=2
fi
fi
# print out all lines, line starter on first line
for (( i=0; i < ${#a_raid_data[@]} - $loop_limit;i++ ))
do
if [[ $i -eq 0 ]];then
line_starter='RAID:'
else
line_starter=' '
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $array_count != '' ]];then
if [[ $i == 0 ]];then
raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count]}" )
print_screen_output "$raid_data"
# we don't want to print anything if it's -b and no data is present, just a waste of a line
if [[ $b_print_lines == 'true' ]];then
# print out all lines, line starter on first line
for (( i=0; i < ${#a_raid_data[@]} - $loop_limit;i++ ))
do
if [[ $i -eq 0 ]];then
line_starter='RAID:'
else
line_starter=' '
fi
fi
raid_data=$( create_print_line "$line_starter" "${a_raid_data[i]}" )
print_screen_output "$raid_data"
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $array_count_unused != '' ]];then
if [[ $i == $(( array_count_unused - 2 )) ]];then
raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count_unused]}" )
print_screen_output "$raid_data"
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $array_count != '' ]];then
if [[ $i == 0 ]];then
raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count]}" )
print_screen_output "$raid_data"
line_starter=' '
fi
fi
fi
done
raid_data=$( create_print_line "$line_starter" "${a_raid_data[i]}" )
print_screen_output "$raid_data"
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $array_count_unused != '' ]];then
if [[ $i == $(( array_count_unused - 2 )) ]];then
raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count_unused]}" )
print_screen_output "$raid_data"
fi
fi
done
fi
eval $LOGFE
}