pass -rc -keep -cleanup to subordinate scripts

This commit is contained in:
George Danchev 2011-06-27 15:36:56 +00:00
parent e6218fad67
commit f6232d1be8

View File

@ -9,6 +9,22 @@ CLOG2=log.$SELF.2
> ${CLOG1}
> ${CLOG2}
PASSED_OPTIONS=""
if [ "${1}" == "-cleanup" ]; then
PASSED_OPTIONS="-cleanup"
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
PASSED_OPTIONS="-rc -keep"
elif [ "${1}" == "-rc" ]; then
PASSED_OPTIONS="-rc"
else
cat << HLP
$0: $0 -rc [-keep]
$0: $0 -cleanup
HLP
exit 0
fi
main() {
#
DSTART=`date --utc`
@ -16,12 +32,12 @@ printf "\n$0: Started at ${DSTART}"
E1=`date '+%s'`
# require ^releng_, avoid running (your)self explcitly
for s in `ls | grep ^releng_ | grep -v ${SELF} | sort`; do
if [ -x ${s} ]; then
printf "\n$0: Running ${s}..."
if [ -x ${s} -a ! -d ${s} ]; then
CMD=""
printf "\n$0: Running ./${s} ${PASSED_OPTIONS}..."
T1=`date '+%s'`
set +e
# -rc -clean are shared options amongst the all releng scripts
./${s} -rc 1>>${CLOG1} 2>>${CLOG2}
./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2}
RET=$?
T2=`date '+%s'`
let TS="${T2}-${T1}"
@ -38,12 +54,13 @@ for s in `ls | grep ^releng_ | grep -v ${SELF} | sort`; do
done
DEND=`date --utc`
printf "\n$0: Finished at ${DEND}. "
printf "\n$0: Finished at ${DEND}.\n"
E2=`date '+%s'`
let ES="${E2}-${E1}"
printf "(total time elapsed ${ES} sec)."
printf "\n$0: Total time elapsed ${ES} sec."
printf "\n$0: Results saved in ${CLOG1} and ${CLOG2}.\n\n"
#
exit 0
}