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

20
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.8.0 #### version: 1.8.1
#### Date: May 10 2012 #### Date: May 11 2012
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -2148,7 +2148,7 @@ show_options()
print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -" print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
print_screen_output "Output Control Options:" print_screen_output "Output Control Options:"
print_screen_output "-A Show Audio/sound card information." 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 "-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 " 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" 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 a_partition_working='' raid_data='' kernel_support='' read_ahead='' unused_devices=''
local basic_raid='' basic_raid_separator='' basic_raid_plural='' inactive='' local basic_raid='' basic_raid_separator='' basic_raid_plural='' inactive=''
local component_separator='' device_id='' print_string='' loop_limit=0 array_count_unused='' 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 get_raid_data
@ -8000,10 +8000,18 @@ print_raid_data()
fi fi
if [[ $B_MDSTAT_FILE != 'true' ]];then if [[ $B_MDSTAT_FILE != 'true' ]];then
if [[ $B_SHOW_BASIC_RAID != 'true' ]];then
a_raid_data[0]="${C1}Error${SEP3}${C2} No /proc/mdstat file detected!" a_raid_data[0]="${C1}Error${SEP3}${C2} No /proc/mdstat file detected!"
else
b_print_lines='false'
fi
else else
if [[ ${a_raid_data[0]} == '' ]];then if [[ ${a_raid_data[0]} == '' ]];then
if [[ $B_SHOW_BASIC_RAID != 'true' ]];then
a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected!" a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected!"
else
b_print_lines='false'
fi
fi fi
# now let's add on the system line and the unused device line. Only print on -xx # 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 if [[ $kernel_support$read_ahead$raid_event != '' ]];then
@ -8017,7 +8025,8 @@ print_raid_data()
loop_limit=2 loop_limit=2
fi fi
fi fi
# 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 # print out all lines, line starter on first line
for (( i=0; i < ${#a_raid_data[@]} - $loop_limit;i++ )) for (( i=0; i < ${#a_raid_data[@]} - $loop_limit;i++ ))
do do
@ -8042,6 +8051,7 @@ print_raid_data()
fi fi
fi fi
done done
fi
eval $LOGFE eval $LOGFE
} }