3 # install.sh - Set up user environment for a XML/XSLT distribution
5 # This is as an interactive installer for updating your
6 # environment to use an XML/XSLT distribution such as the DocBook
7 # XSL Stylesheets. Its main purpose is to configure your
8 # environment with XML catalog data and schema "locating rules"
9 # data provided in the XML/XSLT distribution.
11 # Although this installer was created for the DocBook project, it
12 # is a general-purpose tool that can be used with any XML/XSLT
13 # distribution that provides XML/SGML catalogs and locating rules.
15 # This script is mainly intended to make things easier for you if
16 # you want to install a particular XML/XSLT distribution that has
17 # not (yet) been packaged for your OS distro (Debian, Fedora,
18 # whatever), or to use "snapshot" or development releases
20 # It works by updating your shell startup file (e.g., .bashrc and
21 # .cshrc) and .emacs file and by finding or creating a writable
22 # CatalogManager.properties file to update.
24 # It makes backup copies of any files it touches, and also
25 # generates a uninstall.sh script for reverting its changes.
27 # In the same directory where it is located, it expects to find
28 # the following four files:
33 # And if it's unable to locate a CatalogManager.properties file in
34 # your environment, it expects to find an "example" one in the
35 # same directory as itself, which it copies over to your
36 # ~/.resolver directory.
38 # If the distribution contains any executables, change the value
39 # of the thisBinDir to a colon-separated list of the pathnames of
40 # the directories that contain those executables.
42 # mydir is the "canonical" absolute pathname for install.sh
43 mydir=$(cd -P $(dirname $0) && pwd -P) || exit 1
45 thisLocatingRules=$mydir/locatingrules.xml
46 thisXmlCatalog=$mydir/catalog.xml
47 thisSgmlCatalog=$mydir/catalog
49 # .urilist file contains a list of pairs of local pathnames and
50 # URIs to test for catalog resolution
51 thisUriList=$mydir/.urilist
52 exampleCatalogManager=$mydir/.CatalogManager.properties.example
53 thisCatalogManager=$HOME/.resolver/CatalogManager.properties
55 # thisBinDir directory is a colon-separated list of the pathnames
56 # to all directories that contain executables provided with the
57 # distribution (for example, the DocBook XSL Stylesheets
58 # distribution contains a "docbook-xsl-update" convenience script
59 # for rsync'ing up to the latest docbook-xsl snapshot). The
60 # install.sh script adds the value of thisBinDir to your PATH
61 # environment variable
62 thisBinDir=$mydir/tools/bin
68 if [ ! "${*#--batch}" = "$*" ]; then
73 if [ ! "$1" = "--test" ]; then
74 emit_message "NOTE: For non-interactive installs/uninstalls, use --batch"
75 if [ ! "$1" = "--uninstall" ]; then
82 if uname -s | grep -qi "cygwin"; then
86 classPathSeparator=":"
87 if [ "$osName" = "Cygwin" ]; then
88 thisJavaXmlCatalog=$(cygpath -m $thisXmlCatalog)
89 classPathSeparator=";"
91 thisJavaXmlCatalog=$thisXmlCatalog
100 updateUserStartupFiles
108 rm -f $mydir/.profile.incl
109 rm -f $mydir/.cshrc.incl
110 rm -f $mydir/.emacs.el
114 if [ $(id -u) == "0" ]; then
117 WARNING: This install script is meant to be run as a non-root
118 user, but you are running it as root.
121 read -s -n1 -p "Are you sure you want to continue? [No] "
122 emit_message "$REPLY"
127 *) emit_message "OK, exiting without making changes."
135 updateCatalogManager() {
137 # - finds or creates a writable CatalogManager.properties file
139 # - adds the catalog.xml file for this distribution to the
140 # CatalogManager.properties file found
142 if [ -z "$CLASSPATH" ]; then
145 NOTE: There is no CLASSPATH variable set in your environment.
146 No attempt was made to find a CatalogManager.properties
147 file. Using $thisCatalogManager instead
150 # split CLASSPATH in a list of pathnames by replacing all separator
151 # characters with spaces
152 if [ "$osName" = "Cygwin" ]; then
153 pathnames=$(echo $CLASSPATH | tr ";" " ")
155 pathnames=$(echo $CLASSPATH | tr ":" " ")
157 for path in $pathnames; do
158 if [ "$osName" = "Cygwin" ]; then
159 path=$(cygpath -u $path)
161 # strip out trailing slash from pathname
162 path=$(echo $path | sed 's/\/$//')
163 # find CatalogManager.properties file
164 if [ -f $path/CatalogManager.properties ];
166 existingCatalogManager=$path/CatalogManager.properties
171 # end of CLASSPATH check
173 if [ -w "$existingCatalogManager" ]; then
174 # existing CatalogManager.properties was found and it is
175 # writable, so use it
176 myCatalogManager=$existingCatalogManager
178 if [ -f "$existingCatalogManager" ]; then
179 # a non-writable CatalogManager.properties exists, so emit a
180 # note saying that it won't be used
182 NOTE: $existingCatalogManager file found,
183 but you don't have permission to write to it.
188 # CLASSPATH is set, but no CatalogManager.properties found
189 if [ -n "$CLASSPATH" ]; then
191 NOTE: No CatalogManager.properties found from CLASSPATH.
197 if [ "$batchmode" = "Yes" ]; then
200 # end of check for existing writable CatalogManager.properties
202 if [ -f $thisCatalogManager ]; then
203 myCatalogManager=$thisCatalogManager
206 if [ ! "$batchmode" = "Yes" ]; then
208 read -s -n1 -p "Create $thisCatalogManager file? [Yes] "
209 emit_message "$REPLY"
217 if [ ! -d "${thisCatalogManager%/*}" ]; then
218 mkdir -p ${thisCatalogManager%/*}
220 cp $mydir/.CatalogManager.properties.example $thisCatalogManager || exit 1
221 emit_message "NOTE: Created the following file:"
222 emit_message " $thisCatalogManager"
223 myCatalogManager=$thisCatalogManager
226 # end of creating "private" CatalogManager.properties
228 # end of check for "private" CatalogManager.properties
230 # end of check finding/creating writable CatalogManager.properties
232 if [ -n "$myCatalogManager" ]; then
234 catalogsLine=$(grep "^catalogs=" $myCatalogManager)
235 if [ -f /etc/xml/catalog ] && [ "$osName" != "Cygwin" ] \
236 && [ "${catalogsLine#*/etc/xml/catalog*}" = "$catalogsLine" ]; then
239 WARNING: /etc/xml/catalog exists but was not found in:
241 If /etc/xml/catalog file has content, you probably
242 should reference it in:
244 This installer can automatically add it for you,
245 but BE WARNED that once it has been added, the
246 uninstaller for this distribution CANNOT REMOVE IT
247 automatically during uninstall. If you no longer want
248 it included, you will need to remove it manually.
252 if [ ! "$batchmode" = "Yes" ]; then
253 read -s -n1 -p "Add /etc/xml/catalog to $myCatalogManager? [Yes] "
254 emit_message "$REPLY"
261 etcXmlCatalog=/etc/xml/catalog
266 catalogBackup="$myCatalogManager.$$.bak"
267 if [ ! -w "${myCatalogManager%/*}" ]; then
269 emit_message "WARNING: ${myCatalogManager%/*} directory is not writable."
274 if [ ! "$batchmode" = "Yes" ]; then
276 emit_message "Add $thisJavaXmlCatalog"
277 read -s -n1 -p "to $myCatalogManager file? [Yes] "
278 emit_message "$REPLY"
286 if [ "$catalogsLine" ] ; then
287 if [ "${catalogsLine#*$thisJavaXmlCatalog*}" != "$catalogsLine" ]; then
288 emit_message "NOTE: $thisJavaXmlCatalog"
289 emit_message " already in:"
290 emit_message " $myCatalogManager"
292 mv $myCatalogManager $catalogBackup || exit 1
293 sed "s#^catalogs=\(.*\)\$#catalogs=$thisJavaXmlCatalog;\1;$etcXmlCatalog#" $catalogBackup \
294 | sed 's/;\+/;/' | sed 's/;$//' > $myCatalogManager || exit 1
295 emit_message "NOTE: Successfully updated the following file:"
296 emit_message " $myCatalogManager"
297 emit_message " Backup written to:"
298 emit_message " $catalogBackup"
301 mv $myCatalogManager $catalogBackup || exit 1
302 cp $catalogBackup $myCatalogManager
303 echo "catalogs=$thisJavaXmlCatalog;$etcXmlCatalog" \
304 | sed 's/;\+/;/' | sed 's/;$//' >> $myCatalogManager || exit 1
305 emit_message "NOTE: \"catalogs=\" line added to $myCatalogManager."
306 emit_message " Backup written to $catalogBackup"
310 # end of backing up and updating CatalogManager.properties
313 # end of CatalogManager.properties updates
315 if [ "$osName" = "Cygwin" ]; then
316 myCatalogManager=$(cygpath -m $myCatalogManager)
323 echo "$REPLY" >> $mydir/.profile.incl
325 # $thisBinDir is not in PATH, so add it
326 if [ "\${PATH#*$thisBinDir*}" = "\$PATH" ]; then
327 PATH="$thisBinDir:\$PATH"
330 if [ -z "\$XML_CATALOG_FILES" ]; then
331 XML_CATALOG_FILES="$thisXmlCatalog"
333 # $thisXmlCatalog is not in XML_CATALOG_FILES, so add it
334 if [ "\${XML_CATALOG_FILES#*$thisXmlCatalog*}" = "\$XML_CATALOG_FILES" ]; then
335 XML_CATALOG_FILES="$thisXmlCatalog \$XML_CATALOG_FILES"
338 # /etc/xml/catalog exists but is not in XML_CATALOG_FILES, so add it
339 if [ -f /etc/xml/catalog ] && \
340 [ "\${XML_CATALOG_FILES#*/etc/xml/catalog*}" = "\$XML_CATALOG_FILES" ]; then
341 XML_CATALOG_FILES="\$XML_CATALOG_FILES /etc/xml/catalog"
343 export XML_CATALOG_FILES
345 if [ -z "\$SGML_CATALOG_FILES" ]; then
346 SGML_CATALOG_FILES="$thisSgmlCatalog"
348 # $thisSgmlCatalog is not in SGML_CATALOG_FILES, so add it
349 if [ "\${SGML_CATALOG_FILES#*$thisSgmlCatalog}" = "\$SGML_CATALOG_FILES" ]; then
350 SGML_CATALOG_FILES="$thisSgmlCatalog:\$SGML_CATALOG_FILES"
353 # /etc/sgml/catalog exists but is not in SGML_CATALOG_FILES, so add it
354 if [ -f /etc/sgml/catalog ] && \
355 [ "\${SGML_CATALOG_FILES#*/etc/sgml/catalog*}" = "\$SGML_CATALOG_FILES" ]; then
356 SGML_CATALOG_FILES="\$SGML_CATALOG_FILES:/etc/sgml/catalog"
358 export SGML_CATALOG_FILES
362 echo "$REPLY" >> $mydir/.cshrc.incl
364 # $thisBinDir is not in PATH, so add it
365 if ( "\\\`echo \$PATH | grep -v $thisBinDir\\\`" != "" ) then
366 setenv PATH "$thisBinDir:\$PATH"
368 if ( ! $\?XML_CATALOG_FILES ) then
369 setenv XML_CATALOG_FILES "$thisXmlCatalog"
370 # $thisXmlCatalog is not in XML_CATALOG_FILES, so add it
371 else if ( "\\\`echo \$XML_CATALOG_FILES | grep -v $thisXmlCatalog\\\`" != "" ) then
372 setenv XML_CATALOG_FILES "$thisXmlCatalog \$XML_CATALOG_FILES"
375 # /etc/xml/catalog exists but is not in XML_CATALOG_FILES, so add it
376 if ( -f /etc/xml/catalog && "\\\`echo \$XML_CATALOG_FILES | grep -v /etc/xml/catalog\\\`" != "" ) then
377 setenv XML_CATALOG_FILES "\$XML_CATALOG_FILES /etc/xml/catalog"
381 if ( ! $\?SGML_CATALOG_FILES ) then
382 setenv SGML_CATALOG_FILES "$thisSgmlCatalog"
383 else if ( "\\\`echo \$SGML_CATALOG_FILES | grep -v $thisSgmlCatalog\\\`" != "" ) then
384 setenv SGML_CATALOG_FILES "$thisSgmlCatalog:\$SGML_CATALOG_FILES"
387 # /etc/SGML/catalog exists but is not in SGML_CATALOG_FILES, so add it
388 if ( -f /etc/sgml/catalog && "\\\`echo \$SGML_CATALOG_FILES | grep -v /etc/sgml/catalog\\\`" != "" ) then
389 setenv SGML_CATALOG_FILES {\$SGML_CATALOG_FILES}:/etc/sgml/catalog
393 if [ -n "$myCatalogManager" ]; then
394 myCatalogManagerDir=${myCatalogManager%/*}
396 echo "$REPLY" >> $mydir/.profile.incl
400 if [ -z "\$CLASSPATH" ]; then
401 CLASSPATH="$myCatalogManagerDir"
403 # $myCatalogManagerDir is not in CLASSPATH, so add it
404 if [ "\${CLASSPATH#*$myCatalogManagerDir*}" = "\$CLASSPATH" ]; then
405 CLASSPATH="$myCatalogManagerDir$classPathSeparator\$CLASSPATH"
412 echo "$REPLY" >> $mydir/.cshrc.incl
416 if ( ! $\?CLASSPATH ) then
417 setenv CLASSPATH "$myCatalogManagerDir"
418 # $myCatalogManagerDir is not in CLASSPATH, so add it
419 else if ( "\\\`echo \$CLASSPATH | grep -v $myCatalogManagerDir\\\`" != "" ) then
420 setenv CLASSPATH "$myCatalogManagerDir$classPathSeparator\$CLASSPATH"
428 echo "$REPLY" >> $mydir/.emacs.el
433 (setq rng-schema-locating-files-default
434 (append '("$thisLocatingRules")
435 rng-schema-locating-files-default ))))
441 updateUserStartupFiles() {
442 if [ ! "$batchmode" = "Yes" ]; then
445 NOTE: To source your environment correctly for using the catalog
446 files in this distribution, you need to update one or more
447 of your shell startup files. This installer can
448 automatically make the necessary changes. Or, if you prefer,
449 you can make the changes manually.
456 # if running csh or tcsh, target .cshrc and .tcshrc files for
457 # update; otherwise, target .bash_* and .profiles
459 parent=$(ps -p $PPID | grep "/")
460 if [ "${parent#*csh}" != "$parent" ] || [ "${parent#*tcsh}" != "$parent" ]; then
461 myStartupFiles=".cshrc .tcshrc"
462 appendLine="source $mydir/.cshrc.incl"
464 myStartupFiles=".bash_profile .bash_login .profile .bashrc"
465 appendLine=". $mydir/.profile.incl"
468 for file in $myStartupFiles; do
469 if [ -f "$HOME/$file" ]; then
470 dotFileBackup=$HOME/$file.$$.bak
472 if [ ! "$batchmode" = "Yes" ]; then
473 read -s -n1 -p "Update $HOME/$file? [Yes] "
474 emit_message "$REPLY"
480 NOTE: No change made to $HOME/$file. You either need
481 to add the following line to it, or manually source
482 the shell environment for this distribution each
483 time you want use it.
490 lineExists="$(grep "$appendLine" $HOME/$file )"
491 if [ ! "$lineExists" ]; then
492 mv $HOME/$file $dotFileBackup || exit 1
493 cp $dotFileBackup $HOME/$file || exit 1
494 echo "$appendLine" >> $HOME/$file || exit 1
496 NOTE: Successfully updated the following file:
504 NOTE: The following file already contains information for this
505 distribution, so I did not update it.
514 if [ -z "$dotFileBackup" ]; then
515 if [ ! "$batchmode" = "Yes" ]; then
519 NOTE: No shell startup files updated. You can source the
520 environment for this distribution manually, each time you
521 want to use it, by typing the following.
529 updateUserDotEmacs() {
530 if [ -f $thisLocatingRules ]; then
533 NOTE: This distribution includes a "schema locating rules" file
534 for Emacs/nXML. To use it, you should update either your
535 .emacs or .emacs.el file. This installer can automatically
536 make the necessary changes. Or, if you prefer, you can make
537 the changes manually.
541 emacsAppendLine="(load-file \"$mydir/.emacs.el\")"
543 for file in .emacs .emacs.el; do
544 if [ -f "$HOME/$file" ]; then
545 myEmacsFile=$HOME/$file
549 if [ ! -f "$myEmacsFile" ]; then
551 if [ ! "$batchmode" = "Yes" ]; then
552 read -s -n1 -p "No .emacs or .emacs.el file. Create one? [No] "
553 emit_message "$REPLY"
558 myEmacsFile=$HOME/.emacs
563 NOTE: No Emacs changes made. To use this distribution with,
564 Emacs/nXML, you can create a .emacs file and manually add
565 the following line to it, or you can run it as a command
574 if [ -n "$myEmacsFile" ]; then
576 if [ ! "$batchmode" = "Yes" ]; then
577 read -s -n1 -p "Update $myEmacsFile? [Yes] "
578 emit_message "$REPLY"
585 NOTE: No change made to $myEmacsFile. To use this distribution
586 with Emacs/nXML, you can manually add the following line
587 to your $myEmacsFile, or you can run it as a command
595 lineExists="$(grep "$emacsAppendLine" $myEmacsFile)"
596 if [ ! "$lineExists" ]; then
597 dotEmacsBackup=$myEmacsFile.$$.bak
598 mv $myEmacsFile $dotEmacsBackup || exit 1
599 cp $dotEmacsBackup $myEmacsFile || exit 1
600 echo "$emacsAppendLine" >> $myEmacsFile || exit 1
602 NOTE: Successfully updated the following file:
610 NOTE: The following file already contains information for this
611 distribution, so I did not update it.
623 if [ ! "$batchmode" = "Yes" ]; then
626 NOTE: To "uninstall" this distribution, the changes made to your
627 CatalogManagers.properties, startup files, and/or .emacs
628 file need to be reverted. This uninstaller can automatically
629 revert them. Or, if you prefer, you can revert them manually.
634 if [ "$osName" = "Cygwin" ]; then
635 thisXmlCatalog=$thisJavaXmlCatalog
638 # make "escaped" version of PWD to use with sed and grep
639 escapedPwd=$(echo $mydir | sed "s#/#\\\\\/#g")
641 # check to see if a non-empty value for catalogManager was fed
643 if [ -n ${1#--catalogManager=} ]; then
644 myCatalogManager=${1#--catalogManager=}
645 catalogBackup="$myCatalogManager.$$.bak"
646 catalogsLine=$(grep "^catalogs=" $myCatalogManager)
647 if [ "$catalogsLine" ] ; then
648 if [ "${catalogsLine#*$thisXmlCatalog*}" != "$catalogsLine" ]; then
650 if [ ! "$batchmode" = "Yes" ]; then
651 read -s -n1 -p "Revert $myCatalogManager? [Yes] "
652 emit_message "$REPLY"
658 NOTE: No change made to $myCatalogManager. You need to manually
659 remove the following path from the "catalog=" line.
666 mv $myCatalogManager $catalogBackup || exit 1
667 sed "s#^catalogs=\(.*\)$thisXmlCatalog\(.*\)\$#catalogs=\1\2#" $catalogBackup \
668 | sed 's/;\+/;/' | sed 's/;$//' | sed 's/=;/=/' > $myCatalogManager || exit 1
670 NOTE: Successfully updated the following file:
679 emit_message "NOTE: No data for this distribution found in:"
680 emit_message " $myCatalogManager"
685 NOTE: No data for this distribution was found in the following
686 file, so I did not revert it.
692 if [ -n "$myEmacsFile" ]; then
693 # check to see if a non-empty value for --dotEmacs file was fed
695 if [ -n ${2#--dotEmacs=} ]; then
696 myEmacsFile=${2#--dotEmacs=}
697 revertLine="(load-file \"$escapedPwd\/\.emacs\.el\")"
698 loadLine="$(grep "$revertLine" "$myEmacsFile")"
699 if [ -n "$loadLine" ]; then
702 if [ ! "$batchmode" = "Yes" ]; then
703 read -s -n1 -p "Revert $myEmacsFile? [Yes] "
704 emit_message "$REPLY"
710 NOTE: No change made to $myEmacsFile. You need to manually
711 remove the following line.
713 (load-file \"$mydir/.emacs.el\")
718 dotEmacsBackup=$myEmacsFile.$$.bak
719 sed -e "/$revertLine/d" -i".$$.bak" $myEmacsFile || exit 1
721 NOTE: successfully reverted the following file:
730 emit_message "NOTE: No data for this distribution found in:"
731 emit_message " $myEmacsFile"
736 # check all startup files
737 myStartupFiles=".bash_profile .bash_login .profile .bashrc .cshrc .tcshrc"
738 for file in $myStartupFiles; do
739 if [ -e "$HOME/$file" ]; then
742 revertLine="source $mydir/.cshrc.incl"
743 revertLineEsc="source $escapedPwd\/\.cshrc\.incl"
746 revertLine=". $mydir/.profile.incl"
747 revertLineEsc="\. $escapedPwd\/\.profile\.incl"
750 lineExists="$(grep "$revertLineEsc" $HOME/$file )"
751 if [ "$lineExists" ]; then
753 if [ ! "$batchmode" = "Yes" ]; then
754 read -s -n1 -p "Update $HOME/$file? [Yes] "
755 emit_message "$REPLY"
761 NOTE: No change made to $HOME/$file. You need to manually remove
762 the following line from it.
769 dotFileBackup=$HOME/$file.$$.bak
770 sed -e "/$revertLineEsc/d" -i".$$.bak" $HOME/$file || exit 1
772 NOTE: Successfully updated the following file:
781 emit_message "NOTE: No data for this distribution found in:"
782 emit_message " $HOME/$file"
788 emit_message "Done. Deleted uninstall.sh file."
789 rm -f $mydir/test.sh || exit 1
790 rm -f $mydir/uninstall.sh || exit 1
793 writeUninstallFile() {
794 uninstallFile=$mydir/uninstall.sh
795 echo '#!/bin/bash' > $uninstallFile || exit 1
796 echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $uninstallFile || exit 1
797 echo "\$mydir/install.sh \\" >> $uninstallFile || exit 1
798 echo " --uninstall \\" >> $uninstallFile || exit 1
799 echo " --catalogManager=$myCatalogManager \\" >> $uninstallFile || exit 1
800 echo " --dotEmacs='$myEmacsFile' \\" >> $uninstallFile || exit 1
801 echo ' $@' >> $uninstallFile || exit 1
802 chmod 755 $uninstallFile || exit 1
806 testFile=$mydir/test.sh
807 echo "#!/bin/bash" > $testFile || exit 1
808 echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $testFile || exit 1
809 echo '$mydir/install.sh --test' >> $testFile || exit 1
810 chmod 755 $testFile || exit 1
815 To source your shell environment for this distribution, type the
824 resolverResponse="$(java org.apache.xml.resolver.apps.resolver uri -u foo 2>/dev/null)"
825 if [ -z "$resolverResponse" ]; then
828 NOTE: Your environment does not seem to contain the Apache XML
829 Commons Resolver; without that, you can't use XML catalogs
830 with Java applications. For more information, see the "How
831 to use a catalog file" section in Bob Stayton's "DocBook
832 XSL: The Complete Guide"
834 http://sagehill.net/docbookxsl/UseCatalog.html
843 NOTE: No changes were made to CatalogManagers.properties. To
844 provide your Java tools with XML catalog information for
845 this distribution, you will need to make the appropriate
852 if [ ! -f "$thisXmlCatalog" ]; then
855 FATAL: $thisXmlCatalog file needed but not found. Stopping.
860 if [ -z "$XML_CATALOG_FILES" ]; then
862 emit_message "WARNING: XML_CATALOG_FILES not set. Not testing with xmlcatalog."
864 xmlCatalogResponse="$(xmlcatalog 2>/dev/null)"
865 if [ -z "$xmlCatalogResponse" ]; then
868 WARNING: Cannot locate the "xmlcatalog" command. Make sure that
869 you have libxml2 and its associated utilities installed.
875 emit_message "Testing with xmlcatalog..."
876 # read in pathname-uri pairs from .urilist file
878 if [ ! "${pair%* *}" = "." ]; then
879 path=$mydir/${pair%* *}
885 emit_message " Tested: $uri"
886 for catalog in $XML_CATALOG_FILES; do
887 response="$(xmlcatalog $catalog $uri| grep -v "No entry")"
888 if [ -n "$response" ]; then
889 if [ "$response" = "$path" ]; then
890 emit_message " Result: $path"
893 emit_message " Result: FAILED"
897 done < $mydir/.urilist
901 if [ -z "$CLASSPATH" ]; then
903 emit_message "NOTE: CLASSPATH not set. Not testing with Apache XML Commons Resolver."
905 if [ "$(checkForResolver)" ]; then
909 emit_message "Testing with Apache XML Commons Resolver..."
910 # read in pathname-uri pairs from .urilist file
912 if [ ! "${pair%* *}" = "." ]; then
913 path=$mydir/${pair%* *}
919 emit_message " Tested: $uri"
920 if [ ${uri%.dtd} != $uri ]; then
921 response="$(java org.apache.xml.resolver.apps.resolver system -s $uri | grep "Result")"
923 response="$(java org.apache.xml.resolver.apps.resolver uri -u $uri | grep "Result")"
925 if [ "$response" ]; then
926 if [ "${response#*$path}" != "$response" ]; then
927 emit_message " Result: $path"
929 emit_message " Result: FAILED"
933 done < $mydir/.urilist
938 # get opts and execute appropriate function
953 # Copyright 2005-2007 Michael(tm) Smith <smith@sideshowbarker.net>
955 # Permission is hereby granted, free of charge, to any person
956 # obtaining a copy of this software and associated documentation
957 # files (the "Software"), to deal in the Software without
958 # restriction, including without limitation the rights to use, copy,
959 # modify, merge, publish, distribute, sublicense, and/or sell copies
960 # of the Software, and to permit persons to whom the Software is
961 # furnished to do so, subject to the following conditions:
963 # The above copyright notice and this permission notice shall be
964 # included in all copies or substantial portions of the Software.
966 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
967 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
968 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
969 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
970 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
971 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
972 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
973 # DEALINGS IN THE SOFTWARE.