From 22a6d1912e6afbc1b24e95cbec40a1877c3787ad Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sun, 7 Nov 2010 14:20:02 -0600 Subject: [PATCH] fix raid; make sure mdstat is on this system first, fix printing --- usr/lib/byobu/raid | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/lib/byobu/raid b/usr/lib/byobu/raid index 3c0f5e04..3782f7e0 100755 --- a/usr/lib/byobu/raid +++ b/usr/lib/byobu/raid @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +[ -r /proc/mdstat ] || exit 0 + PKG="byobu" color 2>/dev/null || color() { true; } @@ -33,11 +35,11 @@ if grep -qs " blocks \[.*_.*\]$" /proc/mdstat; then fi if grep -qs \% /proc/mdstat; then - p=$(grep \% /proc/mdstat | sed -e "s/\%.*//" -e "s/.* //") - sync=",$p%" + p=$(grep \% /proc/mdstat | sed -e "s/\%.*/%/" -e "s/.* //") + [ -z "$msg" ] && msg="RAID" + msg="$msg,$p" fi if [ -n "$msg" ]; then - printf "$(color B w r)%s%s$(color -) " "$msg" "$sync" + printf "$(color B w r)%s$(color -) " "$msg" fi -