sort out exit codes

This commit is contained in:
George Danchev
2011-07-02 18:55:09 +00:00
parent e216bfa270
commit 6048b1889a
2 changed files with 26 additions and 21 deletions

View File

@@ -36,7 +36,7 @@ HLP
#####################################################################
# cleanup
if [ "${1}" == "-cleanup" ]; then
cd "${START_DIR_DONT_CHANGE}" || exit 80
cd "${START_DIR_DONT_CHANGE}" || exit 2
if [ -d "${GEN_DATA_DIR}" ]; then
rm -rf ${GEN_DATA_DIR}
printf "${SELF}: removed %s\n" ${GEN_DATA_DIR}
@@ -47,14 +47,14 @@ if [ "${1}" == "-cleanup" ]; then
fi
# help
if [ ! "${1}" ]; then print_help && exit 10; fi
if [ ! "${1}" ]; then print_help && exit 3; fi
# config file
if [ "${1}" == "-rc" ]; then
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 20
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
if [ "${2}" == "-keep" ]; then KEEP=1; fi
# command line args
@@ -63,26 +63,26 @@ elif [ "${1}" ]; then
if [ "${2}" == "-keep" ]; then KEEP=1; fi
# the rest
else
print_help && exit 30
print_help && exit 5
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 2
exit 6
else
mkdir "${GEN_DATA_DIR}"
fi
if [ "${RELENG_XORRISO}" == "" ]; then
echo -e "\n${SELF}: xorriso_cmd is required\n"
exit 40
exit 7
fi
if [ ! -x "${RELENG_XORRISO}" ]; then
printf "${SELF}: Not found or not an executable: $RELENG_XORRISO\n"
exit 50
exit 8
fi
# all must be set at this point
@@ -94,7 +94,7 @@ printf "\n\txorriso_cmd=${RELENG_XORRISO}\n"
if ! "${RELENG_XORRISO}" -version | grep libjte >/dev/null 2>&1; then
printf "\n${SELF}: JTE not supported with this xorriso build. Install jigit and rebuild."
printf "\n${SELF}: See http://www.einval.com/~steve/software/JTE/\n"
exit 51
exit 9
fi
################################################
@@ -128,7 +128,7 @@ if [ -x ${RELENG_MKISOFS} ]; then
fi
if [ ${KEEP} -eq 0 ]; then
cd ${START_DIR_DONT_CHANGE} || exit 2
cd ${START_DIR_DONT_CHANGE} || exit 10
rm -rf ${GEN_DATA_DIR}
fi