check for libjte support in the tested binary and quit gracefully; drop lots of old commented cruft

This commit is contained in:
George Danchev 2011-07-09 08:23:58 +00:00
parent 0a3923c2ed
commit 476dc4cd4d

View File

@ -2,139 +2,39 @@
set -e
# START_DIR_DONT_CHANGE=`pwd`
# SELF=$(basename "$0")
# required config items
#CONFFILE=$HOME/.libburnia-releng/${SELF}.conf
#GEN_DATA_DIR=releng_generated_data/${SELF}
. inc/releng_getopts.inc
if [ ! -x $RELENG_XORRISO ]; then
print_help
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
exit 31
exit 30
fi
# check data dir, if any and after checking -x xorriso
if [ -d "${GEN_DATA_DIR}" ]; then
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
printf "\n${SELF}: use '${SELF} -c1' to remove.\n"
exit 8
exit 1
else
mkdir "${GEN_DATA_DIR}"
fi
TMP_DATA_DIR=releng_generated_data
IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree
# to be set by the config file
# RELENG_XORRISO=""
RELENG_DIR="${IMG_EXTRACT_DIR}"
RELENG_ISOLINUX_BIN="isolinux/isolinux.bin"
RELENG_BOOT_CAT="isolinux/boot.cat"
RELENG_IMG=t1
# KEEP=0
RES=""
REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd"
REMOTE_IMG="debian-testing-i386-businesscard.iso"
#####
#print_help() {
# cat << HLP
#Usage:
# ${SELF} -help
#
# using a config file ${CONFFILE}
# ${SELF} -rc [-keep]
#
# without using a config file
# ${SELF} /absolute/or/relative/path/to/xorriso [-keep]
# cleanup test generated data directory and exit
# ${SELF} -cleanup
#HLP
#}
#####
#cleanup() {
# if [ ${KEEP} -eq 0 ]; then
# # safety net, just in case -> we want to be in the starting
# # directory before removing whatever self-generated stuff
# if [ -d "${GEN_DATA_DIR}" ]; then
# cd "${START_DIR_DONT_CHANGE}" || exit 15
# chmod +w -R ${GEN_DATA_DIR}
# rm -rf ${GEN_DATA_DIR}
# printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
# else
# printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
# fi
# else
# printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
# fi
#}
# cleanup
#if [ "${1}" == "-cleanup" ]; then
# cleanup
# exit 0
#fi
# help
#if [ ! "${1}" ]; then
# print_help && exit 3
# config file
#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
#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}" -a "${2}" == "-keep" ]; then
# RELENG_XORRISO="${1}"
# KEEP=1
#elif [ -x "${1}" ]; then
# RELENG_XORRISO="${1}"
# KEEP=0
# the rest
#else
# print_help && exit 5
#fi
#
# check for required items
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
exit 2
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 8
#else
# mkdir "${GEN_DATA_DIR}"
#fi
# All must be set at this point
printf "${SELF}: Config items:"
printf "\n\txorriso_cmd=${RELENG_XORRISO}\n\tIN_dir=${RELENG_DIR}\n\tOUT_image=${RELENG_IMG}.iso"
@ -147,11 +47,23 @@ if ! "${RELENG_XORRISO}" -version | grep libjte >/dev/null 2>&1; then
printf "\n${SELF}: JTE not supported with this xorriso build. Install jigit >=1.18 and rebuild."
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
cleanup
exit 9
exit 3
fi
# remove cruft from previous runs
# rm -f ${RES}
# check whether the binary support JTE
set +e
RETSTR_VER_JTE=`"${RELENG_XORRISO}" --version 2>/dev/null | grep -P "(libjte\s+in\s+use)"`
RETCODE_VER_JTE="$?"
set -e
case ${RETCODE_VER_JTE} in
0)
printf "\n${SELF}: Found JTE support with ${RELENG_XORRISO} : ${RETSTR_VER_JTE}"
;;
*)
printf "\n${SELF}: FAIL: Not found JTE support in ${RELENG_XORRISO}. Quit.\n"
exit 4
;;
esac
# grab remote ISO image, to decompose
if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
@ -166,7 +78,7 @@ if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
*)
echo -e "\n${SELF}: FAIL: wget returned code: $WGET_RET\n"
cleanup
exit 10
exit 5
;;
esac
else
@ -177,7 +89,7 @@ fi
if [ -d "${IMG_EXTRACT_DIR}" ]; then
printf "\n${SELF}: Found ${IMG_EXTRACT_DIR}. Please cleanup.\n"
cleanup
exit 11
exit 6
else
mkdir "${IMG_EXTRACT_DIR}"
fi
@ -208,7 +120,7 @@ else
printf "\n${SELF}: Not found: "${MKFS_MSDOS}". Install dosfstools."
printf "\n${SELF}: http://www.daniel-baumann.ch/software/dosfstools/\n"
cleanup
exit 12
exit 7
fi
# GENERAL section
@ -235,7 +147,7 @@ CMD+="\
else
printf "\n${SELF}: FAIL to compose the boot section.\n"
cleanup
exit 13
exit 8
fi
# JIGDO section
@ -254,7 +166,7 @@ else
printf "\n${SELF}: Not found: jigdo-gen-md5-list. Install jigit >= 1.18."
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
cleanup
exit 14
exit 9
fi
CMD+="\
@ -287,7 +199,7 @@ else
printf "\n${SELF}: Not found: jigit-mkimage. Install jigit."
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
cleanup
exit 15
exit 10
fi
# trap the exit code of diff and let the Universe explode