support -cleanup
This commit is contained in:
parent
cf34732b18
commit
d67fd2bab7
@ -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
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
# cleanup
|
||||||
|
if [ "${1}" == "-cleanup" ]; then
|
||||||
|
cd "${START_DIR_DONT_CHANGE}" || exit 80
|
||||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||||
printf "\n$0: %s exists!\n" ${GEN_DATA_DIR}
|
rm -rf ${GEN_DATA_DIR}
|
||||||
exit 2
|
printf "$0: removed %s\n" ${GEN_DATA_DIR}
|
||||||
else
|
else
|
||||||
mkdir "${GEN_DATA_DIR}"
|
printf "$0: ${GEN_DATA_DIR} does not exist.\n"
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user