consistent usage/help with other releng scripts

This commit is contained in:
George Danchev 2011-12-14 06:09:22 +00:00
parent c630369e37
commit 6d411f6bab

View File

@ -13,10 +13,13 @@ PASSED_OPTIONS="$@"
RELENG_XORRISO=
CLEANUP_LOG=0
not_in_releng_exit() {
# It is not a good idea to include inc/releng_getopts.inc with the
# master script as it calls the subordinate scripts and they include
# this file too, and we want to avoid sharing variable with subshells
if [ ! -f inc/releng_getopts.inc ]; then
printf "\nPlease execute the tests from releng directory.\n\n"
exit 1
}
fi
# To catch the exit value of a command in a pipe
return_value_file="$GEN_DATA_DIR"/run_all_"$$"_return_value
@ -52,17 +55,45 @@ count_lines()
return 0
}
# It is not a good idea to include inc/releng_getopts.inc with the
# master script as it calls the subordinate scripts and they include
# this file too, and we want to avoid sharing variable with subshells
if [ ! -f inc/releng_getopts.inc ]; then
not_in_releng_exit
fi
#############################################
print_usage()
{
cat << HLP
${SELF} runs executables from releng directory starting with auto_*,
and passing them its own options. stdout/stderr output is stored in:
./${CLOG}
Usage: ${SELF} -x path/to/xorriso [-k] [-c] [-h]
-x absolute or relative path to xorriso binary to be run.
-k keep self-generated data in ./${GEN_DATA_DIR}.
-c cleanup self-generated data kept from previous run and exit.
-h print this help text
Examples:
# run xorriso and keep the self-generated data
$ ./${SELF} -x path/to/xorriso -k
# clean up self-generated data from previous run
$ ./${SELF} -c
HLP
}
#############################################
if [ ! "${1}" ]; then
print_usage
exit 0
fi
next_is=
for i in "$@"
do
if test x"$i" = x"-h" -o x"$i" = x"--h" -o x"$i" = x"-help" -o x"$i" = x"--help"
then :
print_usage
exit 0
fi
if test "$next_is" = "ignore"
then :
elif test "$next_is" = "x"
@ -85,24 +116,6 @@ then
exit 31
fi
if [ ! "${1}" ]; then
cat << HLP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
${SELF} runs executables from CWD starting
with auto_*, passing them its own options.
stdout/stderr output stored in:
${CLOG}
examples:
# run xorriso and keep the self-generated data
$ ./${SELF} -x path/to/xorriso [-k]
# clean up self-generated data from previous run
$ ./${SELF} -c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HLP
exit 31
fi
########################################################
if [ -f "${CLOG}" ]; then