Change the prerequisite tests so that alfs tools are first checked, then blfs,
and the host reqs are tested later
This commit is contained in:
parent
382b083182
commit
6ed3dd7533
2 changed files with 64 additions and 54 deletions
|
@ -34,11 +34,11 @@ inline_doc
|
||||||
local IFS
|
local IFS
|
||||||
|
|
||||||
write_error_and_die() {
|
write_error_and_die() {
|
||||||
echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
|
echo -e "\n\t\t$TXT is missing or version -->${tst_version}<-- is too old.
|
||||||
This script requires ${ref_version} or greater\n"
|
This script requires ${ref_version} or greater\n"
|
||||||
# Ask the user instead of bomb, to make happy that packages which version
|
# Ask the user instead of bomb, to make happy that packages which version
|
||||||
# ouput don't follow our expectations
|
# ouput don't follow our expectations
|
||||||
echo "If you are sure that you have instaled a proper version of ${BOLD}$TXT${OFF}"
|
echo "If you are sure that you have installed a proper version of ${BOLD}$TXT${OFF}"
|
||||||
echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue,"
|
echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue,"
|
||||||
echo -n "otherwise press 'ENTER' key to stop jhalfs. "
|
echo -n "otherwise press 'ENTER' key to stop jhalfs. "
|
||||||
read ANSWER
|
read ANSWER
|
||||||
|
@ -88,7 +88,6 @@ inline_doc
|
||||||
check_prerequisites() { #
|
check_prerequisites() { #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
||||||
# Maybe we should check xsltproc first?
|
|
||||||
case $PROGNAME in
|
case $PROGNAME in
|
||||||
clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
|
clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
|
||||||
*) HOSTREQS="prologue/hostreqs.xml" ;;
|
*) HOSTREQS="prologue/hostreqs.xml" ;;
|
||||||
|
@ -127,18 +126,30 @@ check_prerequisites() { #
|
||||||
check_version "$MIN_Sed_VER" "$(sed --version | head -n1 | cut -d" " -f4)" "SED"
|
check_version "$MIN_Sed_VER" "$(sed --version | head -n1 | cut -d" " -f4)" "SED"
|
||||||
check_version "$MIN_Texinfo_VER" "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
|
check_version "$MIN_Texinfo_VER" "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
|
||||||
check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ"
|
check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ"
|
||||||
|
}
|
||||||
|
|
||||||
|
#----------------------------#
|
||||||
|
check_alfs_tools() { #
|
||||||
|
#----------------------------#
|
||||||
|
: << inline_doc
|
||||||
|
Those tools are needed for the proper operation of jhalfs
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
# Avoid translation of version strings
|
||||||
|
local LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
# Check for minimum sudo version
|
# Check for minimum sudo version
|
||||||
if [ -z $MIN_Sudo_VER ]; then MIN_Sudo_VER=1.7.0; fi
|
|
||||||
SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
|
SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
|
||||||
if [ -x $SUDO_LOC ]; then
|
if [ -x $SUDO_LOC ]; then
|
||||||
sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
|
sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
|
||||||
check_version "$MIN_Sudo_VER" "${sudoVer}" "SUDO"
|
check_version "1.7.0" "${sudoVer}" "SUDO"
|
||||||
else
|
else
|
||||||
echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for minimum wget version
|
# Check for wget presence (using a dummy version)
|
||||||
WGET_LOC="$(whereis -b wget | cut -d" " -f2)"
|
WGET_LOC="$(whereis -b wget | cut -d" " -f2)"
|
||||||
if [ -x $WGET_LOC ]; then
|
if [ -x $WGET_LOC ]; then
|
||||||
wgetVer="$(wget --version | head -n1 | cut -d" " -f3)"
|
wgetVer="$(wget --version | head -n1 | cut -d" " -f3)"
|
||||||
|
@ -148,17 +159,16 @@ check_prerequisites() { #
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Before checking libmxl2 and libxslt version information, ensure tools needed from those
|
# Before checking libxml2 and libxslt version information, ensure tools
|
||||||
# packages are actually available. Avoids a small cosmetic bug of book version information
|
# needed from those packages are actually available. Avoids a small
|
||||||
# not being retrieved if xmllint is unavailable, especially when on recent non-LFS hosts.
|
# 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)"
|
XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)"
|
||||||
XSLTPROC_LOC="$(whereis -b xsltproc | 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
|
if [ ! -x $XMLLINT_LOC ]; then
|
||||||
echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||||
echo ${XML_NOTE_MSG}
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,19 +185,26 @@ check_prerequisites() { #
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||||
echo ${XML_NOTE_MSG}
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# The next versions checks are required only when BLFS_TOOL is set and
|
}
|
||||||
# this dependencies has not be selected for installation
|
|
||||||
if [[ "$BLFS_TOOL" = "y" ]] ; then
|
#----------------------------#
|
||||||
|
check_blfs_tools() { #
|
||||||
|
#----------------------------#
|
||||||
|
: << inline_doc
|
||||||
|
In addition to the tools needed for the LFS part, tidy and docbook-xml
|
||||||
|
are needed for installing the BLFS tools
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
# Avoid translation of version strings
|
||||||
|
local LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
if [[ -z "$DEP_TIDY" ]] ; then
|
|
||||||
tidyVer=$(tidy -V | cut -d " " -f9)
|
tidyVer=$(tidy -V | cut -d " " -f9)
|
||||||
check_version "2004" "${tidyVer}" "TIDY"
|
check_version "2004" "${tidyVer}" "TIDY"
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
|
# Minimal docbook-xml code for testing
|
||||||
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
||||||
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
|
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
|
||||||
|
@ -200,24 +217,10 @@ XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
</sect1>
|
</sect1>
|
||||||
</article>"
|
</article>"
|
||||||
|
|
||||||
if [[ -z "$DEP_DBXML" ]] ; then
|
if `echo $XML_FILE | xmllint -nonet -noout -postvalid - 2>/dev/null` ; then
|
||||||
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
|
|
||||||
check_version "4.5" "4.5" "DocBook XML DTD"
|
check_version "4.5" "4.5" "DocBook XML DTD"
|
||||||
else
|
else
|
||||||
echo "Warning: not found a working DocBook XML DTD 4.5 installation"
|
echo "Error: you need docbook for installing BLFS tools"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# if [[ -z "$DEP_DBXSL" ]] ; then
|
|
||||||
# if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
|
|
||||||
# check_version "1.69.1" "1.69.1" "DocBook XSL"
|
|
||||||
# else
|
|
||||||
# echo "Warning: not found a working DocBook XSL 1.69.1 installation"
|
|
||||||
# exit 2
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
|
|
||||||
fi # end BLFS_TOOL=Y
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
11
jhalfs
11
jhalfs
|
@ -245,11 +245,19 @@ source $COMMON_DIR/libs/func_custom_pkgs
|
||||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||||
|
|
||||||
|
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||||
|
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
|
||||||
|
check_alfs_tools
|
||||||
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||||
|
|
||||||
# blfs-tool envars
|
# blfs-tool envars
|
||||||
BLFS_TOOL=${BLFS_TOOL:-n}
|
BLFS_TOOL=${BLFS_TOOL:-n}
|
||||||
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
||||||
|
check_blfs_tools
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||||
BLFS_SVN=${BLFS_SVN:-n}
|
BLFS_SVN=${BLFS_SVN:-n}
|
||||||
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
||||||
BLFS_BRANCH=${BLFS_BRANCH:-n}
|
BLFS_BRANCH=${BLFS_BRANCH:-n}
|
||||||
|
@ -400,8 +408,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
#
|
#
|
||||||
# Install blfs-tool, if requested.
|
# Install blfs-tool, if requested.
|
||||||
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
echo Downloading and validating the BLFS book
|
echo Installing BLFS book and tools
|
||||||
echo '(may take some time...)'
|
|
||||||
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
||||||
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Reference in a new issue