support -cleanup

This commit is contained in:
George Danchev 2011-06-27 14:50:50 +00:00
parent 050b93514a
commit 248cc97e0b
2 changed files with 27 additions and 6 deletions

View File

@ -15,7 +15,8 @@ Release Engineering Che[at|ck] List
+ start a new test over the top of template_new_releng + start a new test over the top of template_new_releng
+ file name starts with releng_ + file name starts with releng_
+ any generated data to be stored in ./$0.result directory + 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} + well documented configuration file test.conf{.template}
+ throw FAIL string to stdout if any failure is detected + throw FAIL string to stdout if any failure is detected
+ exit code 0 on success, non-zero on failure + exit code 0 on success, non-zero on failure

View File

@ -20,20 +20,31 @@ print_help() {
cat << HLP cat << HLP
Usage: Usage:
$0 -help $0 -help
# using a config file ${CONFFILE} # using a config file ${CONFFILE}
$0 -rc [-keep] $0 -rc [-keep]
# without using a config file # without using a config file
$0 xorriso_cmd IN_dir OUT_image [IN_isolinux] [OUT_bootcat] [-keep] $0 xorriso_cmd IN_dir OUT_image [IN_isolinux] [OUT_bootcat] [-keep]
# cleanup test generated data directory and exit
$0 -cleanup
HLP HLP
} }
##################################################################### #####################################################################
if [ -d "${GEN_DATA_DIR}" ]; then # cleanup
printf "\n$0: %s exists!\n" ${GEN_DATA_DIR} if [ "${1}" == "-cleanup" ]; then
exit 2 cd "${START_DIR_DONT_CHANGE}" || exit 80
else if [ -d "${GEN_DATA_DIR}" ]; then
mkdir "${GEN_DATA_DIR}" 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 fi
# help # help
if [ ! "${1}" ]; then print_help && exit 10; fi if [ ! "${1}" ]; then print_help && exit 10; fi
# config file # config file
@ -60,6 +71,15 @@ else
print_help && exit 30 print_help && exit 30
fi 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 if [ "${XOR}" == "" -o "${DIR}" == "" -o "${IMG}" == "" ]; then
echo -e "\n$0: xorriso_cmd IN_dir and OUT_image are required\n" echo -e "\n$0: xorriso_cmd IN_dir and OUT_image are required\n"
exit 40 exit 40