enable settings via cmdline too

This commit is contained in:
George Danchev 2011-07-03 15:07:36 +00:00
parent 4b44b023e9
commit cb8bbd6c53
1 changed files with 30 additions and 12 deletions

View File

@ -33,6 +33,9 @@ Usage:
# using a config file ${CONFFILE}
${SELF} -rc [-keep]
# without using a config file
${SELF} /path/to/xorriso
# cleanup test generated data directory and exit
${SELF} -cleanup
HLP
@ -59,39 +62,54 @@ if [ "${1}" == "-cleanup" ]; then
fi
# help
if [ ! "${1}" ]; then print_help && exit 3; fi
if [ ! "${1}" ]; then
print_help && exit 3
# config file
if [ "${1}" == "-rc" ]; then
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
KEEP=1
if [ -e ${CONFFILE} ]; then
. ${CONFFILE}
printf "${SELF}: Using config file %s\n" ${CONFFILE}
else
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
if [ "${2}" == "-keep" ]; then KEEP=1; fi
elif [ "${1}" == "-rc" -a ! "${2}" ]; then
KEEP=0
if [ -e ${CONFFILE} ]; then
. ${CONFFILE}
printf "${SELF}: Using config file %s\n" ${CONFFILE}
else
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
# cmdline option
elif [ -x "${1}" ]; then
RELENG_XORRISO="${1}"
# the rest
else
print_help && exit 5
fi
#
if [ "${RELENG_XORRISO}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == "" ]; then
echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are required\n"
exit 6
fi
if [ ! -x "${RELENG_XORRISO}" ]; then
printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
exit 7
fi
# data dir
if [ -d "${GEN_DATA_DIR}" ]; then
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
exit 6
exit 8
else
mkdir "${GEN_DATA_DIR}"
fi
if [ "${RELENG_XORRISO}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == "" ]; then
echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are required\n"
exit 7
fi
if [ ! -x "${RELENG_XORRISO}" ]; then
printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
exit 8
fi
# all must be set at this point
printf "${SELF}: Config items:"