sort out exit codes
This commit is contained in:
parent
f8a36b3fc9
commit
5360404f82
@ -35,7 +35,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}
|
||||
@ -46,14 +46,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
|
||||
@ -68,26 +68,31 @@ elif [ "${3}" ]; then
|
||||
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}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == "" ]; then
|
||||
echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are 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
|
||||
printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
|
||||
exit 8
|
||||
fi
|
||||
|
||||
if [ ! -d "${RELENG_DIR}" ]; then
|
||||
printf "${SELF}: $RELENG_DIR does not exist or not a directory.\n"
|
||||
exit 9
|
||||
fi
|
||||
|
||||
# all must be set at this point
|
||||
@ -101,7 +106,7 @@ RES="${RELENG_IMG}.iso ${RELENG_IMG}.new ${RELENG_IMG}.md5 ${RELENG_IMG}.jigdo $
|
||||
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 10
|
||||
fi
|
||||
|
||||
# remove cruft from previous runs
|
||||
@ -121,7 +126,7 @@ if which jigdo-gen-md5-list >/dev/null 2>&1; then
|
||||
else
|
||||
printf "\n${SELF}: Not found: jigdo-gen-md5-list. Install jigit."
|
||||
printf "\n${SELF}: See http://www.einval.com/~steve/software/JTE/\n"
|
||||
exit 60
|
||||
exit 11
|
||||
fi
|
||||
|
||||
# build the command - general section
|
||||
@ -176,7 +181,7 @@ if which jigit-mkimage >/dev/null 2>&1; then
|
||||
else
|
||||
printf "\n${SELF}: Not found: jigit-mkimage. Install jigit."
|
||||
printf "\n${SELF}: See http://www.einval.com/~steve/software/JTE/\n"
|
||||
exit 70
|
||||
exit 12
|
||||
fi
|
||||
|
||||
# trap the exit code of diff and let the Universe explode
|
||||
@ -195,7 +200,7 @@ esac
|
||||
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
|
||||
cd "${START_DIR_DONT_CHANGE}" || exit 13
|
||||
rm -rf ${GEN_DATA_DIR}
|
||||
printf "${SELF}: removed %s\n" ${GEN_DATA_DIR}
|
||||
else
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user