added a protection against no /proc/mdstat might be needed on old systems, we'll see.

This commit is contained in:
inxi-svn 2012-05-11 06:21:32 +00:00
parent 65aa044f30
commit f744c6ffbe

33
inxi
View file

@ -5476,7 +5476,7 @@ get_raid_data()
local mdstat='' local mdstat=''
if [[ $B_MDSTAT_FILE ]];then if [[ $B_MDSTAT_FILE ]];then
mdstat="$( cat $FILE_MDSTAT )" mdstat="$( cat $FILE_MDSTAT 2>/dev/null )"
fi fi
if [[ -n $mdstat ]];then if [[ -n $mdstat ]];then
@ -7792,7 +7792,7 @@ print_raid_data()
local finish_time='' recovery_speed='' raid_counter=0 device_counter=1 basic_counter=1 local finish_time='' recovery_speed='' raid_counter=0 device_counter=1 basic_counter=1
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='' 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=''
get_raid_data get_raid_data
@ -7999,17 +7999,22 @@ print_raid_data()
a_raid_data[0]="${C1}Device$basic_raid_plural${SEP3}${C2} $basic_raid" a_raid_data[0]="${C1}Device$basic_raid_plural${SEP3}${C2} $basic_raid"
fi fi
if [[ ${a_raid_data[0]} == '' ]];then if [[ ${a_raid_data[0]} == '' ]];then
a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected" if [[ $B_MDSTAT_FILE == 'true' ]];then
fi a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected"
# 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
array_count=${#a_raid_data[@]} array_count=${#a_raid_data[@]}
a_raid_data[array_count]="${C1}System${SEP3}${C2}$kernel_support$read_ahead$raid_event" a_raid_data[array_count]="${C1}System${SEP3}${C2}$kernel_support$read_ahead$raid_event"
loop_limit=1 loop_limit=1
if [[ $unused_devices != '' ]];then fi
array_count_unused=${#a_raid_data[@]} if [[ $unused_devices != '' ]];then
a_raid_data[array_count_unused]="$unused_devices" array_count_unused=${#a_raid_data[@]}
loop_limit=2 a_raid_data[array_count_unused]="$unused_devices"
loop_limit=2
fi
else
a_raid_data[0]="${C1}No /proc/mdstat file detected!${C2} "
fi
fi fi
# print out all lines, line starter on first line # print out all lines, line starter on first line
@ -8020,7 +8025,7 @@ print_raid_data()
else else
line_starter=' ' line_starter=' '
fi fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $B_EXTRA_EXTRA_DATA == 'true' && $array_count != '' ]];then
if [[ $i == 0 ]];then if [[ $i == 0 ]];then
raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count]}" ) raid_data=$( create_print_line "$line_starter" "${a_raid_data[array_count]}" )
print_screen_output "$raid_data" print_screen_output "$raid_data"