Fix bug where if xmllint is not installed, book version information is not extracted to be used for lfs-release,lsb-release and SBU reports.

Added checks in the code to ensure both xmllint and xstlproc are available prior to use.
This commit is contained in:
Thomas Pegg 2013-03-19 01:01:30 +00:00
parent c80aa1f7f8
commit f445e26055

View file

@ -129,6 +129,22 @@ check_prerequisites() { #
exit 1 exit 1
fi fi
# Before checking libmxl2 and libxslt version information, ensure tools needed from those
# packages are actually available. Avoids a small cosmetic bug of book version information
# not being retrieved if xmllint is unavailable, especially when on recent non-LFS hosts.
XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)"
XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)"
XML_NOTE_MSG="${nl_} ${BOLD} This can happen when running jhalfs on non-LFS hosts. ${OFF}"
if [ ! -x $XMLLINT_LOC ]; then
echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
echo ${XML_NOTE_MSG}
exit 1
fi
if [ -x $XSLTPROC_LOC ]; then
# Check for minimum libxml2 and libxslt versions # Check for minimum libxml2 and libxslt versions
xsltprocVer=$(xsltproc -V | head -n1 ) xsltprocVer=$(xsltproc -V | head -n1 )
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3) libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
@ -138,6 +154,11 @@ check_prerequisites() { #
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2" check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT" check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
else
echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
echo ${XML_NOTE_MSG}
exit 1
fi
# The next versions checks are required only when BLFS_TOOL is set and # The next versions checks are required only when BLFS_TOOL is set and
# this dependencies has not be selected for installation # this dependencies has not be selected for installation
if [[ "$BLFS_TOOL" = "y" ]] ; then if [[ "$BLFS_TOOL" = "y" ]] ; then