enable settings via cmdline too
This commit is contained in:
parent
e8882ec805
commit
8d3b19a510
@ -33,6 +33,9 @@ Usage:
|
|||||||
# using a config file ${CONFFILE}
|
# using a config file ${CONFFILE}
|
||||||
${SELF} -rc [-keep]
|
${SELF} -rc [-keep]
|
||||||
|
|
||||||
|
# without using a config file
|
||||||
|
${SELF} /path/to/xorriso
|
||||||
|
|
||||||
# cleanup test generated data directory and exit
|
# cleanup test generated data directory and exit
|
||||||
${SELF} -cleanup
|
${SELF} -cleanup
|
||||||
HLP
|
HLP
|
||||||
@ -59,39 +62,54 @@ if [ "${1}" == "-cleanup" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# help
|
# help
|
||||||
if [ ! "${1}" ]; then print_help && exit 3; fi
|
if [ ! "${1}" ]; then
|
||||||
|
print_help && exit 3
|
||||||
# config file
|
# config file
|
||||||
if [ "${1}" == "-rc" ]; then
|
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
|
||||||
|
KEEP=1
|
||||||
if [ -e ${CONFFILE} ]; then
|
if [ -e ${CONFFILE} ]; then
|
||||||
. ${CONFFILE}
|
. ${CONFFILE}
|
||||||
printf "${SELF}: Using config file %s\n" ${CONFFILE}
|
printf "${SELF}: Using config file %s\n" ${CONFFILE}
|
||||||
else
|
else
|
||||||
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
|
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
|
||||||
fi
|
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
|
# the rest
|
||||||
else
|
else
|
||||||
print_help && exit 5
|
print_help && exit 5
|
||||||
fi
|
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
|
# data dir
|
||||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||||
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
||||||
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
|
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
|
||||||
exit 6
|
exit 8
|
||||||
else
|
else
|
||||||
mkdir "${GEN_DATA_DIR}"
|
mkdir "${GEN_DATA_DIR}"
|
||||||
fi
|
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
|
# all must be set at this point
|
||||||
printf "${SELF}: Config items:"
|
printf "${SELF}: Config items:"
|
||||||
|
Loading…
Reference in New Issue
Block a user