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
+ 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

View File

@ -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