implement -keep

This commit is contained in:
George Danchev
2011-06-27 14:31:39 +00:00
parent a4fa6ff919
commit cf34732b18
3 changed files with 10 additions and 10 deletions

View File

@ -12,7 +12,7 @@ IMG=""
ISOLINUX_BIN=""
BOOT_CAT=""
CONFFILE=$HOME/releng_build_isojigdo.conf
CLEAN=0
KEEP=0
GEN_DATA_DIR=$0.result
RES=""
@ -21,9 +21,9 @@ print_help() {
Usage:
$0 -help
# using a config file ${CONFFILE}
$0 -rc [-clean]
$0 -rc [-keep]
# without using a config file
$0 xorriso_cmd IN_dir OUT_image [IN_isolinux] [OUT_bootcat] [-clean]
$0 xorriso_cmd IN_dir OUT_image [IN_isolinux] [OUT_bootcat] [-keep]
HLP
}
@ -44,7 +44,7 @@ if [ "${1}" == "-rc" ]; then
else
echo -e "\n$0: Config file ${CONFFILE} not found.\n" && exit 20
fi
if [ "${2}" == "-clean" ]; then CLEAN=1; fi
if [ "${2}" == "-keep" ]; then KEEP=1; fi
# command line args
elif [ "${3}" ]; then
XOR="${1}"
@ -53,7 +53,7 @@ elif [ "${3}" ]; then
if [ "${4}" ]; then
ISOLINUX_BIN="${4}"
if [ "${5}" ]; then BOOT_CAT="${5}"; fi
if [ "${4}" == "-clean" -o "${5}" == "-clean" -o "${6}" == "-clean" ]; then CLEAN=1; fi
if [ "${4}" == "-keep" -o "${5}" == "-keep" -o "${6}" == "-keep" ]; then KEEP=1; fi
fi
# the rest
else
@ -172,14 +172,14 @@ case ${DIFF_RET} in
esac
# sort out the cruft
if [ ${CLEAN} -eq 1 ]; then
if [ ${KEEP} -eq 0 ]; then
# safety net, just in case -> we want to be in the starting
# directory before removing whatever self-generated stuff
cd "${START_DIR_DONT_CHANGE}" || exit 80
rm -rf ${GEN_DATA_DIR}
printf "$0: removed %s\n" ${GEN_DATA_DIR}
else
printf "$0: left %s\n" ${GEN_DATA_DIR}
printf "$0: leaving %s\n" ${GEN_DATA_DIR}
fi
# last hints