mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
added a protection against no /proc/mdstat might be needed on old systems, we'll see.
This commit is contained in:
parent
65aa044f30
commit
f744c6ffbe
35
inxi
35
inxi
|
@ -5476,7 +5476,7 @@ get_raid_data()
|
|||
local mdstat=''
|
||||
|
||||
if [[ $B_MDSTAT_FILE ]];then
|
||||
mdstat="$( cat $FILE_MDSTAT )"
|
||||
mdstat="$( cat $FILE_MDSTAT 2>/dev/null )"
|
||||
fi
|
||||
|
||||
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 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='' array_count_unused=''
|
||||
local component_separator='' device_id='' print_string='' loop_limit=0 array_count_unused=''
|
||||
local array_count='' raid_event=''
|
||||
|
||||
get_raid_data
|
||||
|
@ -7999,19 +7999,24 @@ print_raid_data()
|
|||
a_raid_data[0]="${C1}Device$basic_raid_plural${SEP3}${C2} $basic_raid"
|
||||
fi
|
||||
if [[ ${a_raid_data[0]} == '' ]];then
|
||||
a_raid_data[0]="${C1}Device${SEP3}${C2} No RAID devices detected"
|
||||
if [[ $B_MDSTAT_FILE == 'true' ]];then
|
||||
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
|
||||
if [[ $kernel_support$read_ahead$raid_event != '' ]];then
|
||||
array_count=${#a_raid_data[@]}
|
||||
a_raid_data[array_count]="${C1}System${SEP3}${C2}$kernel_support$read_ahead$raid_event"
|
||||
loop_limit=1
|
||||
fi
|
||||
if [[ $unused_devices != '' ]];then
|
||||
array_count_unused=${#a_raid_data[@]}
|
||||
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
|
||||
|
||||
# now let's add on the system line and the unused device line. Only print on -xx
|
||||
array_count=${#a_raid_data[@]}
|
||||
a_raid_data[array_count]="${C1}System${SEP3}${C2}$kernel_support$read_ahead$raid_event"
|
||||
loop_limit=1
|
||||
if [[ $unused_devices != '' ]];then
|
||||
array_count_unused=${#a_raid_data[@]}
|
||||
a_raid_data[array_count_unused]="$unused_devices"
|
||||
loop_limit=2
|
||||
fi
|
||||
|
||||
|
||||
# print out all lines, line starter on first line
|
||||
for (( i=0; i < ${#a_raid_data[@]} - $loop_limit;i++ ))
|
||||
do
|
||||
|
@ -8020,7 +8025,7 @@ print_raid_data()
|
|||
else
|
||||
line_starter=' '
|
||||
fi
|
||||
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue