1#!/bin/sh 2# $FreeBSD$ 3 4set -e 5 6if mount | grep ccd3 ; then 7 echo "ccd3 seems to be mounted" 8 exit 1 9fi 10 11( 12ccdconfig -u ccd3 || true 13mdconfig -d -u 90 || true 14mdconfig -d -u 91 || true 15mdconfig -d -u 92 || true 16mdconfig -d -u 93 || true 17) > /dev/null 2>&1 18 19mdconfig -a -t malloc -s $1 -u 90 20mdconfig -a -t malloc -s $2 -u 91 21mdconfig -a -t malloc -s $3 -u 92 22mdconfig -a -t malloc -s $4 -u 93 23 24ccdconfig -v ccd3 $5 $6 /dev/md90 /dev/md91 /dev/md92 /dev/md93 25./a > /dev/ccd3 26 27md5 < /dev/md90 28md5 < /dev/md91 29md5 < /dev/md92 30md5 < /dev/md93 31 32( 33./b < /dev/md90 | sed -e 1,16d -e 's/^/md90 /' 34./b < /dev/md91 | sed -e 1,16d -e 's/^/md91 /' 35./b < /dev/md92 | sed -e 1,16d -e 's/^/md92 /' 36./b < /dev/md93 | sed -e 1,16d -e 's/^/md93 /' 37) | sort +2n | awk ' 38 { 39 if ($1 != l1) { 40 if (l1 != "") { 41 if (l1 == "md90") printf "" 42 if (l1 == "md91") printf " " 43 if (l1 == "md92") printf " " 44 if (l1 == "md93") printf " " 45 print l3,l2,l 46 } 47 l1 = $1 48 l2 = $2 49 l3 = $3 50 l = 0; 51 } 52 l++; 53 } 54END { 55 if (l1 == "md90") printf "" 56 if (l1 == "md91") printf " " 57 if (l1 == "md92") printf " " 58 if (l1 == "md93") printf " " 59 print l3,l2,l 60 } 61' 62