By suggestion and good sense, -R has been modified. New tarball as well.

Now RAID works like this:

-b - if no /proc/mdstat, or if no devices found and module is running, show nothing, otherwise show short form as before
-F - if no proc/mdstat, show nothing, if no devices but mdstat and if -xx, show all lines, otherwise show normal
-R - show all messages and missing file/module information so users, particularly sys admins, know right away module
is running even if no devices.
-v 6 and less, like -F. -v 7, like -R run, ie, show all messages.

this gets rid of unneeded line output given that only if you have md_mod running will you have any data for /proc/mdstat
and that module is only running if you have mdraid installed. 

Also redid the no data messages for no module state and no devices state to better reflect what is actually happening.

Good adjustment and good cleanup of unneeded output while tightening the actual usability of the specific messages received.
This commit is contained in:
inxi-svn 2012-05-15 01:51:58 +00:00
parent e7323c0512
commit 4bdb6b0621

20
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.8.2
#### Date: May 11 2012
#### version: 1.8.3
#### Date: May 14 2012
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -282,6 +282,8 @@ B_SHOW_PARTITIONS_FULL='false'
B_SHOW_PS_CPU_DATA='false'
B_SHOW_PS_MEM_DATA='false'
B_SHOW_RAID='false'
# because many systems have no mdstat file, -b/-F should not show error if no raid file found
B_SHOW_RAID_R='false'
B_SHOW_REPOS='false'
B_RUNNING_IN_X='false'
B_SHOW_SENSORS='false'
@ -1926,6 +1928,10 @@ get_parameters()
use_short='false'
;;
R) B_SHOW_RAID='true'
# it turns out only users with mdraid software installed will have raid,
# so unless -R is explicitly called, blank -b/-F/-v6 and less output will not show
# error if file is missing.
B_SHOW_RAID_R='true'
use_short='false'
;;
s) B_SHOW_SENSORS='true'
@ -1993,6 +1999,7 @@ get_parameters()
if [[ $OPTARG -ge 7 ]];then
B_EXTRA_EXTRA_DATA='true'
B_SHOW_IP='true'
B_SHOW_RAID_R='true'
fi
else
error_handler 4 "$OPTARG"
@ -7795,7 +7802,7 @@ print_raid_data()
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='' b_print_lines='true'
get_raid_data
for (( i=0; i < ${#A_RAID_DATA[@]}; i++ ))
@ -7984,7 +7991,6 @@ print_raid_data()
read_ahead=${a_partition_working[1]}
read_ahead=" ${C1}read ahead${SEP3}${C2} $read_ahead"
fi
elif [[ ${a_partition_working[0]} == 'UnusedDevices' ]];then
if [[ ${a_partition_working[1]} == '' ]];then
unused_devices='N/A'
@ -8005,15 +8011,15 @@ print_raid_data()
fi
if [[ $B_MDSTAT_FILE != 'true' ]];then
if [[ $B_SHOW_BASIC_RAID != 'true' ]];then
a_raid_data[0]="${C1}Error${SEP3}${C2} No $FILE_MDSTAT file detected!"
if [[ $B_SHOW_RAID_R == 'true' ]];then
a_raid_data[0]="No RAID data available - $FILE_MDSTAT is missing - is md_mod kernel module loaded?"
else
b_print_lines='false'
fi
else
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]="No RAID devices detected - /proc/mdstat and md_mod kernel raid module present"
else
b_print_lines='false'
fi