From 248cc97e0bcf25964ac8283a9e4ea38901b246f4 Mon Sep 17 00:00:00 2001 From: George Danchev Date: Mon, 27 Jun 2011 14:50:50 +0000 Subject: [PATCH] support -cleanup --- releng/README.releng | 3 ++- releng/releng_build_isojigdo | 30 +++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/releng/README.releng b/releng/README.releng index aa05908d..9a0c47f7 100644 --- a/releng/README.releng +++ b/releng/README.releng @@ -15,7 +15,8 @@ Release Engineering Che[at|ck] List + start a new test over the top of template_new_releng + file name starts with releng_ + any generated data to be stored in ./$0.result directory - + mandatory options -rc [-clean] + + test data generation options -rc [-keep] + + test data removal options -cleanup + well documented configuration file test.conf{.template} + throw FAIL string to stdout if any failure is detected + exit code 0 on success, non-zero on failure diff --git a/releng/releng_build_isojigdo b/releng/releng_build_isojigdo index 1162c117..9794d6fc 100755 --- a/releng/releng_build_isojigdo +++ b/releng/releng_build_isojigdo @@ -20,20 +20,31 @@ print_help() { cat << HLP Usage: $0 -help + # using a config file ${CONFFILE} $0 -rc [-keep] + # without using a config file $0 xorriso_cmd IN_dir OUT_image [IN_isolinux] [OUT_bootcat] [-keep] + +# cleanup test generated data directory and exit + $0 -cleanup HLP } ##################################################################### -if [ -d "${GEN_DATA_DIR}" ]; then - printf "\n$0: %s exists!\n" ${GEN_DATA_DIR} - exit 2 -else - mkdir "${GEN_DATA_DIR}" +# cleanup +if [ "${1}" == "-cleanup" ]; then + cd "${START_DIR_DONT_CHANGE}" || exit 80 + if [ -d "${GEN_DATA_DIR}" ]; then + rm -rf ${GEN_DATA_DIR} + printf "$0: removed %s\n" ${GEN_DATA_DIR} + else + printf "$0: ${GEN_DATA_DIR} does not exist.\n" + fi + exit 0 fi + # help if [ ! "${1}" ]; then print_help && exit 10; fi # config file @@ -60,6 +71,15 @@ else print_help && exit 30 fi +# data dir +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n$0: directory %s exists!" ${GEN_DATA_DIR} + printf "\n$0: use '$0 -cleanup' to remove.\n" + exit 2 +else + mkdir "${GEN_DATA_DIR}" +fi + if [ "${XOR}" == "" -o "${DIR}" == "" -o "${IMG}" == "" ]; then echo -e "\n$0: xorriso_cmd IN_dir and OUT_image are required\n" exit 40