From 6d411f6babe981afd6ede8b9fc5565ebf6f5dd0e Mon Sep 17 00:00:00 2001 From: George Danchev Date: Wed, 14 Dec 2011 06:09:22 +0000 Subject: [PATCH] consistent usage/help with other releng scripts --- libisoburn/trunk/releng/run_all_auto | 65 +++++++++++++++++----------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/libisoburn/trunk/releng/run_all_auto b/libisoburn/trunk/releng/run_all_auto index 7cf09b5d..0b488697 100755 --- a/libisoburn/trunk/releng/run_all_auto +++ b/libisoburn/trunk/releng/run_all_auto @@ -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