Changeset 6ed3dd7 for common/libs/func_check_version.sh
- Timestamp:
- 12/15/2013 10:10:25 AM (11 years ago)
- Branches:
- 2.4, ablfs-more, legacy, new_features, trunk
- Children:
- 532ede6
- Parents:
- 382b083
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/libs/func_check_version.sh
r382b083 r6ed3dd7 35 35 36 36 write_error_and_die() { 37 echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.37 echo -e "\n\t\t$TXT is missing or version -->${tst_version}<-- is too old. 38 38 This script requires ${ref_version} or greater\n" 39 39 # Ask the user instead of bomb, to make happy that packages which version 40 40 # ouput don't follow our expectations 41 echo "If you are sure that you have instal ed a proper version of ${BOLD}$TXT${OFF}"41 echo "If you are sure that you have installed a proper version of ${BOLD}$TXT${OFF}" 42 42 echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue," 43 43 echo -n "otherwise press 'ENTER' key to stop jhalfs. " … … 89 89 #----------------------------# 90 90 91 # Maybe we should check xsltproc first? 92 case $PROGNAME in 93 clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;; 94 *) HOSTREQS="prologue/hostreqs.xml" ;; 95 esac 91 case $PROGNAME in 92 clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;; 93 *) HOSTREQS="prologue/hostreqs.xml" ;; 94 esac 96 95 97 96 eval $(xsltproc $COMMON_DIR/hostreqs.xsl $BOOK/$HOSTREQS) … … 128 127 check_version "$MIN_Texinfo_VER" "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO" 129 128 check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ" 129 } 130 131 #----------------------------# 132 check_alfs_tools() { # 133 #----------------------------# 134 : << inline_doc 135 Those tools are needed for the proper operation of jhalfs 136 inline_doc 137 138 # Avoid translation of version strings 139 local LC_ALL=C 140 export LC_ALL 141 130 142 # Check for minimum sudo version 131 if [ -z $MIN_Sudo_VER ]; then MIN_Sudo_VER=1.7.0; fi132 143 SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)" 133 144 if [ -x $SUDO_LOC ]; then 134 145 sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)" 135 check_version " $MIN_Sudo_VER" "${sudoVer}" "SUDO"146 check_version "1.7.0" "${sudoVer}" "SUDO" 136 147 else 137 148 echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run" … … 139 150 fi 140 151 141 # Check for minimum wget version152 # Check for wget presence (using a dummy version) 142 153 WGET_LOC="$(whereis -b wget | cut -d" " -f2)" 143 154 if [ -x $WGET_LOC ]; then … … 149 160 fi 150 161 151 # Before checking libmxl2 and libxslt version information, ensure tools needed from those 152 # packages are actually available. Avoids a small cosmetic bug of book version information 153 # not being retrieved if xmllint is unavailable, especially when on recent non-LFS hosts. 162 # Before checking libxml2 and libxslt version information, ensure tools 163 # needed from those packages are actually available. Avoids a small 164 # cosmetic bug of book version information not being retrieved if 165 # xmllint is unavailable, especially when on recent non-LFS hosts. 154 166 155 167 XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)" 156 168 XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)" 157 XML_NOTE_MSG="${nl_} ${BOLD} This can happen when running jhalfs on non-LFS hosts. ${OFF}"158 169 159 170 if [ ! -x $XMLLINT_LOC ]; then 160 171 echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run" 161 echo ${XML_NOTE_MSG}162 172 exit 1 163 173 fi … … 165 175 if [ -x $XSLTPROC_LOC ]; then 166 176 167 # Check for minimum libxml2 and libxslt versions168 xsltprocVer=$(xsltproc -V | head -n1 )169 libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)170 libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)171 172 # Version numbers are packed strings not xx.yy.zz format.173 check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"174 check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"177 # Check for minimum libxml2 and libxslt versions 178 xsltprocVer=$(xsltproc -V | head -n1 ) 179 libxmlVer=$(echo $xsltprocVer | cut -d " " -f3) 180 libxsltVer=$(echo $xsltprocVer | cut -d " " -f5) 181 182 # Version numbers are packed strings not xx.yy.zz format. 183 check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2" 184 check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT" 175 185 176 186 else 177 187 echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run" 178 echo ${XML_NOTE_MSG} 179 exit 1 180 fi 181 # The next versions checks are required only when BLFS_TOOL is set and 182 # this dependencies has not be selected for installation 183 if [[ "$BLFS_TOOL" = "y" ]] ; then 184 185 if [[ -z "$DEP_TIDY" ]] ; then 186 tidyVer=$(tidy -V | cut -d " " -f9) 187 check_version "2004" "${tidyVer}" "TIDY" 188 fi 189 190 # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed 191 XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?> 188 exit 1 189 fi 190 } 191 192 #----------------------------# 193 check_blfs_tools() { # 194 #----------------------------# 195 : << inline_doc 196 In addition to the tools needed for the LFS part, tidy and docbook-xml 197 are needed for installing the BLFS tools 198 inline_doc 199 200 # Avoid translation of version strings 201 local LC_ALL=C 202 export LC_ALL 203 204 tidyVer=$(tidy -V | cut -d " " -f9) 205 check_version "2004" "${tidyVer}" "TIDY" 206 207 # Minimal docbook-xml code for testing 208 XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?> 192 209 <?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?> 193 210 <!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' … … 201 218 </article>" 202 219 203 if [[ -z "$DEP_DBXML" ]] ; then 204 if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then 205 check_version "4.5" "4.5" "DocBook XML DTD" 206 else 207 echo "Warning: not found a working DocBook XML DTD 4.5 installation" 208 exit 2 209 fi 210 fi 211 212 # if [[ -z "$DEP_DBXSL" ]] ; then 213 # if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then 214 # check_version "1.69.1" "1.69.1" "DocBook XSL" 215 # else 216 # echo "Warning: not found a working DocBook XSL 1.69.1 installation" 217 # exit 2 218 # fi 219 # fi 220 221 fi # end BLFS_TOOL=Y 222 223 } 220 if `echo $XML_FILE | xmllint -nonet -noout -postvalid - 2>/dev/null` ; then 221 check_version "4.5" "4.5" "DocBook XML DTD" 222 else 223 echo "Error: you need docbook for installing BLFS tools" 224 exit 2 225 fi 226 }
Note:
See TracChangeset
for help on using the changeset viewer.