#!/bin/sh 
. ./functions
if [ $1 == "--help" -o $1 == "-h" ];then
	echo "mkraidconf.sh [-h|--help] <conf_path>"
	echo "    This shell make the raid's configure file, the command follow the path of the file, for example /mnt/etc/mdadm.conf. If in the cdrom suggest to use /mnt/etc/mdadm.conf, and in the disk suggest to use /etc/mdadm.conf.Other path you can try, but it may be not work conveniently for the mdadm."
	echo ""
	echo "Report bugs to <zrlang@linx-info.com>"
	exit 0
fi

if [ -z $1 ]; then
	info "empty argument, please look the usage by --help or -h"
	exit 1
fi

CONDIR=`dirname $1`
if [ ! -d $CONDIR ]; then
	mkdir -p $CONDIR >>${DEV_LOG} 2>>${DEV_LOG}
	if [ $? -ne 0 ]; then
		info "make directory ${CONDIR} lose, please look the usage by --help or -h"
		exit 1
	fi
fi
mdadm -Ds -v > $TARGET$1 2>>${DEV_LOG}
if [ $? -eq 0 ];then
	info "make $1 allright"
else
	info "make $1 lose"
	exit 1
fi
