2 # $Id: install.sh 7942 2008-03-26 06:08:08Z xmldoc $
5 # install.sh - Set up user environment for a XML/XSLT distribution
7 # This is as an interactive installer for updating your
8 # environment to use an XML/XSLT distribution such as the DocBook
9 # XSL Stylesheets. Its main purpose is to configure your
10 # environment with XML catalog data and schema "locating rules"
11 # data provided in the XML/XSLT distribution.
13 # Although this installer was created for the DocBook project, it
14 # is a general-purpose tool that can be used with any XML/XSLT
15 # distribution that provides XML/SGML catalogs and locating rules.
17 # This script is mainly intended to make things easier for you if
18 # you want to install a particular XML/XSLT distribution that has
19 # not (yet) been packaged for your OS distro (Debian, Fedora,
20 # whatever), or to use "snapshot" or development releases
22 # It works by updating your shell startup file (e.g., .bashrc and
23 # .cshrc) and .emacs file and by finding or creating a writable
24 # CatalogManager.properties file to update.
26 # It makes backup copies of any files it touches, and also
27 # generates a uninstall.sh script for reverting its changes.
29 # In the same directory where it is located, it expects to find
30 # the following four files:
35 # And if it's unable to locate a CatalogManager.properties file in
36 # your environment, it expects to find an "example" one in the
37 # same directory as itself, which it copies over to your
38 # ~/.resolver directory.
40 # If the distribution contains any executables, change the value
41 # of the thisBinDir to a colon-separated list of the pathnames of
42 # the directories that contain those executables.
44 # mydir is the "canonical" absolute pathname for install.sh
45 mydir=$(cd -P $(dirname $0) && pwd -P) || exit 1
47 thisLocatingRules=$mydir/locatingrules.xml
48 thisXmlCatalog=$mydir/catalog.xml
49 thisSgmlCatalog=$mydir/catalog
51 # .urilist file contains a list of pairs of local pathnames and
52 # URIs to test for catalog resolution
53 thisUriList=$mydir/.urilist
54 exampleCatalogManager=$mydir/.CatalogManager.properties.example
55 thisCatalogManager=$HOME/.resolver/CatalogManager.properties
57 # thisBinDir directory is a colon-separated list of the pathnames
58 # to all directories that contain executables provided with the
59 # distribution (for example, the DocBook XSL Stylesheets
60 # distribution contains a "docbook-xsl-update" convenience script
61 # for rsync'ing up to the latest docbook-xsl snapshot). The
62 # install.sh script adds the value of thisBinDir to your PATH
63 # environment variable
64 thisBinDir=$mydir/tools/bin
70 if [ ! "${*#--batch}" = "$*" ]; then
75 if [ ! "$1" = "--test" ]; then
76 emit_message "NOTE: For non-interactive installs/uninstalls, use --batch"
77 if [ ! "$1" = "--uninstall" ]; then
84 if uname -s | grep -qi "cygwin"; then
88 classPathSeparator=":"
89 if [ "$osName" = "Cygwin" ]; then
90 thisJavaXmlCatalog=$(cygpath -m $thisXmlCatalog)
91 classPathSeparator=";"
93 thisJavaXmlCatalog=$thisXmlCatalog
102 updateUserStartupFiles
110 rm -f $mydir/.profile.incl
111 rm -f $mydir/.cshrc.incl
112 rm -f $mydir/.emacs.el
116 if [ $(id -u) == "0" ]; then
119 WARNING: This install script is meant to be run as a non-root
120 user, but you are running it as root.
123 read -s -n1 -p "Are you sure you want to continue? [No] "
124 emit_message "$REPLY"
129 *) emit_message "OK, exiting without making changes."
137 updateCatalogManager() {
139 # - finds or creates a writable CatalogManager.properties file
141 # - adds the catalog.xml file for this distribution to the
142 # CatalogManager.properties file found
144 if [ -z "$CLASSPATH" ]; then
147 NOTE: There is no CLASSPATH variable set in your environment.
148 No attempt was made to find a CatalogManager.properties
149 file. Using $thisCatalogManager instead
152 # split CLASSPATH in a list of pathnames by replacing all separator
153 # characters with spaces
154 if [ "$osName" = "Cygwin" ]; then
155 pathnames=$(echo $CLASSPATH | tr ";" " ")
157 pathnames=$(echo $CLASSPATH | tr ":" " ")
159 for path in $pathnames; do
160 if [ "$osName" = "Cygwin" ]; then
161 path=$(cygpath -u $path)
163 # strip out trailing slash from pathname
164 path=$(echo $path | sed 's/\/$//')
165 # find CatalogManager.properties file
166 if [ -f $path/CatalogManager.properties ];
168 existingCatalogManager=$path/CatalogManager.properties
173 # end of CLASSPATH check
175 if [ -w "$existingCatalogManager" ]; then
176 # existing CatalogManager.properties was found and it is
177 # writable, so use it
178 myCatalogManager=$existingCatalogManager
180 if [ -f "$existingCatalogManager" ]; then
181 # a non-writable CatalogManager.properties exists, so emit a
182 # note saying that it won't be used
184 NOTE: $existingCatalogManager file found,
185 but you don't have permission to write to it.
190 # CLASSPATH is set, but no CatalogManager.properties found
191 if [ -n "$CLASSPATH" ]; then
193 NOTE: No CatalogManager.properties found from CLASSPATH.
199 if [ "$batchmode" = "Yes" ]; then
202 # end of check for existing writable CatalogManager.properties
204 if [ -f $thisCatalogManager ]; then
205 myCatalogManager=$thisCatalogManager
208 if [ ! "$batchmode" = "Yes" ]; then
210 read -s -n1 -p "Create $thisCatalogManager file? [Yes] "
211 emit_message "$REPLY"
219 if [ ! -d "${thisCatalogManager%/*}" ]; then
220 mkdir -p ${thisCatalogManager%/*}
222 cp $mydir/.CatalogManager.properties.example $thisCatalogManager || exit 1
223 emit_message "NOTE: Created the following file:"
224 emit_message " $thisCatalogManager"
225 myCatalogManager=$thisCatalogManager
228 # end of creating "private" CatalogManager.properties
230 # end of check for "private" CatalogManager.properties
232 # end of check finding/creating writable CatalogManager.properties
234 if [ -n "$myCatalogManager" ]; then
236 catalogsLine=$(grep "^catalogs=" $myCatalogManager)
237 if [ -f /etc/xml/catalog ] && [ "$osName" != "Cygwin" ] \
238 && [ "${catalogsLine#*/etc/xml/catalog*}" = "$catalogsLine" ]; then
241 WARNING: /etc/xml/catalog exists but was not found in:
243 If /etc/xml/catalog file has content, you probably
244 should reference it in:
246 This installer can automatically add it for you,
247 but BE WARNED that once it has been added, the
248 uninstaller for this distribution CANNOT REMOVE IT
249 automatically during uninstall. If you no longer want
250 it included, you will need to remove it manually.
254 if [ ! "$batchmode" = "Yes" ]; then
255 read -s -n1 -p "Add /etc/xml/catalog to $myCatalogManager? [Yes] "
256 emit_message "$REPLY"
263 etcXmlCatalog=/etc/xml/catalog
268 catalogBackup="$myCatalogManager.$$.bak"
269 if [ ! -w "${myCatalogManager%/*}" ]; then
271 emit_message "WARNING: ${myCatalogManager%/*} directory is not writable."
276 if [ ! "$batchmode" = "Yes" ]; then
278 emit_message "Add $thisJavaXmlCatalog"
279 read -s -n1 -p "to $myCatalogManager file? [Yes] "
280 emit_message "$REPLY"
288 if [ "$catalogsLine" ] ; then
289 if [ "${catalogsLine#*$thisJavaXmlCatalog*}" != "$catalogsLine" ]; then
290 emit_message "NOTE: $thisJavaXmlCatalog"
291 emit_message " already in:"
292 emit_message " $myCatalogManager"
294 mv $myCatalogManager $catalogBackup || exit 1
295 sed "s#^catalogs=\(.*\)\$#catalogs=$thisJavaXmlCatalog;\1;$etcXmlCatalog#" $catalogBackup \
296 | sed 's/;\+/;/' | sed 's/;$//' > $myCatalogManager || exit 1
297 emit_message "NOTE: Successfully updated the following file:"
298 emit_message " $myCatalogManager"
299 emit_message " Backup written to:"
300 emit_message " $catalogBackup"
303 mv $myCatalogManager $catalogBackup || exit 1
304 cp $catalogBackup $myCatalogManager
305 echo "catalogs=$thisJavaXmlCatalog;$etcXmlCatalog" \
306 | sed 's/;\+/;/' | sed 's/;$//' >> $myCatalogManager || exit 1
307 emit_message "NOTE: \"catalogs=\" line added to $myCatalogManager."
308 emit_message " Backup written to $catalogBackup"
312 # end of backing up and updating CatalogManager.properties
315 # end of CatalogManager.properties updates
317 if [ "$osName" = "Cygwin" ]; then
318 myCatalogManager=$(cygpath -m $myCatalogManager)
325 echo "$REPLY" >> $mydir/.profile.incl
327 # $thisBinDir is not in PATH, so add it
328 if [ "\${PATH#*$thisBinDir*}" = "\$PATH" ]; then
329 PATH="$thisBinDir:\$PATH"
332 if [ -z "\$XML_CATALOG_FILES" ]; then
333 XML_CATALOG_FILES="$thisXmlCatalog"
335 # $thisXmlCatalog is not in XML_CATALOG_FILES, so add it
336 if [ "\${XML_CATALOG_FILES#*$thisXmlCatalog*}" = "\$XML_CATALOG_FILES" ]; then
337 XML_CATALOG_FILES="$thisXmlCatalog \$XML_CATALOG_FILES"
340 # /etc/xml/catalog exists but is not in XML_CATALOG_FILES, so add it
341 if [ -f /etc/xml/catalog ] && \
342 [ "\${XML_CATALOG_FILES#*/etc/xml/catalog*}" = "\$XML_CATALOG_FILES" ]; then
343 XML_CATALOG_FILES="\$XML_CATALOG_FILES /etc/xml/catalog"
345 export XML_CATALOG_FILES
347 if [ -z "\$SGML_CATALOG_FILES" ]; then
348 SGML_CATALOG_FILES="$thisSgmlCatalog"
350 # $thisSgmlCatalog is not in SGML_CATALOG_FILES, so add it
351 if [ "\${SGML_CATALOG_FILES#*$thisSgmlCatalog}" = "\$SGML_CATALOG_FILES" ]; then
352 SGML_CATALOG_FILES="$thisSgmlCatalog:\$SGML_CATALOG_FILES"
355 # /etc/sgml/catalog exists but is not in SGML_CATALOG_FILES, so add it
356 if [ -f /etc/sgml/catalog ] && \
357 [ "\${SGML_CATALOG_FILES#*/etc/sgml/catalog*}" = "\$SGML_CATALOG_FILES" ]; then
358 SGML_CATALOG_FILES="\$SGML_CATALOG_FILES:/etc/sgml/catalog"
360 export SGML_CATALOG_FILES
364 echo "$REPLY" >> $mydir/.cshrc.incl
366 # $thisBinDir is not in PATH, so add it
367 if ( "\\\`echo \$PATH | grep -v $thisBinDir\\\`" != "" ) then
368 setenv PATH "$thisBinDir:\$PATH"
370 if ( ! $\?XML_CATALOG_FILES ) then
371 setenv XML_CATALOG_FILES "$thisXmlCatalog"
372 # $thisXmlCatalog is not in XML_CATALOG_FILES, so add it
373 else if ( "\\\`echo \$XML_CATALOG_FILES | grep -v $thisXmlCatalog\\\`" != "" ) then
374 setenv XML_CATALOG_FILES "$thisXmlCatalog \$XML_CATALOG_FILES"
377 # /etc/xml/catalog exists but is not in XML_CATALOG_FILES, so add it
378 if ( -f /etc/xml/catalog && "\\\`echo \$XML_CATALOG_FILES | grep -v /etc/xml/catalog\\\`" != "" ) then
379 setenv XML_CATALOG_FILES "\$XML_CATALOG_FILES /etc/xml/catalog"
383 if ( ! $\?SGML_CATALOG_FILES ) then
384 setenv SGML_CATALOG_FILES "$thisSgmlCatalog"
385 else if ( "\\\`echo \$SGML_CATALOG_FILES | grep -v $thisSgmlCatalog\\\`" != "" ) then
386 setenv SGML_CATALOG_FILES "$thisSgmlCatalog:\$SGML_CATALOG_FILES"
389 # /etc/SGML/catalog exists but is not in SGML_CATALOG_FILES, so add it
390 if ( -f /etc/sgml/catalog && "\\\`echo \$SGML_CATALOG_FILES | grep -v /etc/sgml/catalog\\\`" != "" ) then
391 setenv SGML_CATALOG_FILES {\$SGML_CATALOG_FILES}:/etc/sgml/catalog
395 if [ -n "$myCatalogManager" ]; then
396 myCatalogManagerDir=${myCatalogManager%/*}
398 echo "$REPLY" >> $mydir/.profile.incl
402 if [ -z "\$CLASSPATH" ]; then
403 CLASSPATH="$myCatalogManagerDir"
405 # $myCatalogManagerDir is not in CLASSPATH, so add it
406 if [ "\${CLASSPATH#*$myCatalogManagerDir*}" = "\$CLASSPATH" ]; then
407 CLASSPATH="$myCatalogManagerDir$classPathSeparator\$CLASSPATH"
414 echo "$REPLY" >> $mydir/.cshrc.incl
418 if ( ! $\?CLASSPATH ) then
419 setenv CLASSPATH "$myCatalogManagerDir"
420 # $myCatalogManagerDir is not in CLASSPATH, so add it
421 else if ( "\\\`echo \$CLASSPATH | grep -v $myCatalogManagerDir\\\`" != "" ) then
422 setenv CLASSPATH "$myCatalogManagerDir$classPathSeparator\$CLASSPATH"
430 echo "$REPLY" >> $mydir/.emacs.el
435 (setq rng-schema-locating-files-default
436 (append '("$thisLocatingRules")
437 rng-schema-locating-files-default ))))
443 updateUserStartupFiles() {
444 if [ ! "$batchmode" = "Yes" ]; then
447 NOTE: To source your environment correctly for using the catalog
448 files in this distribution, you need to update one or more
449 of your shell startup files. This installer can
450 automatically make the necessary changes. Or, if you prefer,
451 you can make the changes manually.
458 # if running csh or tcsh, target .cshrc and .tcshrc files for
459 # update; otherwise, target .bash_* and .profiles
461 parent=$(ps -p $PPID | grep "/")
462 if [ "${parent#*csh}" != "$parent" ] || [ "${parent#*tcsh}" != "$parent" ]; then
463 myStartupFiles=".cshrc .tcshrc"
464 appendLine="source $mydir/.cshrc.incl"
466 myStartupFiles=".bash_profile .bash_login .profile .bashrc"
467 appendLine=". $mydir/.profile.incl"
470 for file in $myStartupFiles; do
471 if [ -f "$HOME/$file" ]; then
472 dotFileBackup=$HOME/$file.$$.bak
474 if [ ! "$batchmode" = "Yes" ]; then
475 read -s -n1 -p "Update $HOME/$file? [Yes] "
476 emit_message "$REPLY"
482 NOTE: No change made to $HOME/$file. You either need
483 to add the following line to it, or manually source
484 the shell environment for this distribution each
485 time you want use it.
492 lineExists="$(grep "$appendLine" $HOME/$file )"
493 if [ ! "$lineExists" ]; then
494 mv $HOME/$file $dotFileBackup || exit 1
495 cp $dotFileBackup $HOME/$file || exit 1
496 echo "$appendLine" >> $HOME/$file || exit 1
498 NOTE: Successfully updated the following file:
506 NOTE: The following file already contains information for this
507 distribution, so I did not update it.
516 if [ -z "$dotFileBackup" ]; then
517 if [ ! "$batchmode" = "Yes" ]; then
521 NOTE: No shell startup files updated. You can source the
522 environment for this distribution manually, each time you
523 want to use it, by typing the following.
531 updateUserDotEmacs() {
532 if [ -f $thisLocatingRules ]; then
535 NOTE: This distribution includes a "schema locating rules" file
536 for Emacs/nXML. To use it, you should update either your
537 .emacs or .emacs.el file. This installer can automatically
538 make the necessary changes. Or, if you prefer, you can make
539 the changes manually.
543 emacsAppendLine="(load-file \"$mydir/.emacs.el\")"
545 for file in .emacs .emacs.el; do
546 if [ -f "$HOME/$file" ]; then
547 myEmacsFile=$HOME/$file
551 if [ ! -f "$myEmacsFile" ]; then
553 if [ ! "$batchmode" = "Yes" ]; then
554 read -s -n1 -p "No .emacs or .emacs.el file. Create one? [No] "
555 emit_message "$REPLY"
560 myEmacsFile=$HOME/.emacs
565 NOTE: No Emacs changes made. To use this distribution with,
566 Emacs/nXML, you can create a .emacs file and manually add
567 the following line to it, or you can run it as a command
576 if [ -n "$myEmacsFile" ]; then
578 if [ ! "$batchmode" = "Yes" ]; then
579 read -s -n1 -p "Update $myEmacsFile? [Yes] "
580 emit_message "$REPLY"
587 NOTE: No change made to $myEmacsFile. To use this distribution
588 with Emacs/nXML, you can manually add the following line
589 to your $myEmacsFile, or you can run it as a command
597 lineExists="$(grep "$emacsAppendLine" $myEmacsFile)"
598 if [ ! "$lineExists" ]; then
599 dotEmacsBackup=$myEmacsFile.$$.bak
600 mv $myEmacsFile $dotEmacsBackup || exit 1
601 cp $dotEmacsBackup $myEmacsFile || exit 1
602 echo "$emacsAppendLine" >> $myEmacsFile || exit 1
604 NOTE: Successfully updated the following file:
612 NOTE: The following file already contains information for this
613 distribution, so I did not update it.
625 if [ ! "$batchmode" = "Yes" ]; then
628 NOTE: To "uninstall" this distribution, the changes made to your
629 CatalogManagers.properties, startup files, and/or .emacs
630 file need to be reverted. This uninstaller can automatically
631 revert them. Or, if you prefer, you can revert them manually.
636 if [ "$osName" = "Cygwin" ]; then
637 thisXmlCatalog=$thisJavaXmlCatalog
640 # make "escaped" version of PWD to use with sed and grep
641 escapedPwd=$(echo $mydir | sed "s#/#\\\\\/#g")
643 # check to see if a non-empty value for catalogManager was fed
645 if [ -n ${1#--catalogManager=} ]; then
646 myCatalogManager=${1#--catalogManager=}
647 catalogBackup="$myCatalogManager.$$.bak"
648 catalogsLine=$(grep "^catalogs=" $myCatalogManager)
649 if [ "$catalogsLine" ] ; then
650 if [ "${catalogsLine#*$thisXmlCatalog*}" != "$catalogsLine" ]; then
652 if [ ! "$batchmode" = "Yes" ]; then
653 read -s -n1 -p "Revert $myCatalogManager? [Yes] "
654 emit_message "$REPLY"
660 NOTE: No change made to $myCatalogManager. You need to manually
661 remove the following path from the "catalog=" line.
668 mv $myCatalogManager $catalogBackup || exit 1
669 sed "s#^catalogs=\(.*\)$thisXmlCatalog\(.*\)\$#catalogs=\1\2#" $catalogBackup \
670 | sed 's/;\+/;/' | sed 's/;$//' | sed 's/=;/=/' > $myCatalogManager || exit 1
672 NOTE: Successfully updated the following file:
681 emit_message "NOTE: No data for this distribution found in:"
682 emit_message " $myCatalogManager"
687 NOTE: No data for this distribution was found in the following
688 file, so I did not revert it.
694 if [ -n "$myEmacsFile" ]; then
695 # check to see if a non-empty value for --dotEmacs file was fed
697 if [ -n ${2#--dotEmacs=} ]; then
698 myEmacsFile=${2#--dotEmacs=}
699 revertLine="(load-file \"$escapedPwd\/\.emacs\.el\")"
700 loadLine="$(grep "$revertLine" "$myEmacsFile")"
701 if [ -n "$loadLine" ]; then
704 if [ ! "$batchmode" = "Yes" ]; then
705 read -s -n1 -p "Revert $myEmacsFile? [Yes] "
706 emit_message "$REPLY"
712 NOTE: No change made to $myEmacsFile. You need to manually
713 remove the following line.
715 (load-file \"$mydir/.emacs.el\")
720 dotEmacsBackup=$myEmacsFile.$$.bak
721 sed -e "/$revertLine/d" -i".$$.bak" $myEmacsFile || exit 1
723 NOTE: successfully reverted the following file:
732 emit_message "NOTE: No data for this distribution found in:"
733 emit_message " $myEmacsFile"
738 # check all startup files
739 myStartupFiles=".bash_profile .bash_login .profile .bashrc .cshrc .tcshrc"
740 for file in $myStartupFiles; do
741 if [ -e "$HOME/$file" ]; then
744 revertLine="source $mydir/.cshrc.incl"
745 revertLineEsc="source $escapedPwd\/\.cshrc\.incl"
748 revertLine=". $mydir/.profile.incl"
749 revertLineEsc="\. $escapedPwd\/\.profile\.incl"
752 lineExists="$(grep "$revertLineEsc" $HOME/$file )"
753 if [ "$lineExists" ]; then
755 if [ ! "$batchmode" = "Yes" ]; then
756 read -s -n1 -p "Update $HOME/$file? [Yes] "
757 emit_message "$REPLY"
763 NOTE: No change made to $HOME/$file. You need to manually remove
764 the following line from it.
771 dotFileBackup=$HOME/$file.$$.bak
772 sed -e "/$revertLineEsc/d" -i".$$.bak" $HOME/$file || exit 1
774 NOTE: Successfully updated the following file:
783 emit_message "NOTE: No data for this distribution found in:"
784 emit_message " $HOME/$file"
790 emit_message "Done. Deleted uninstall.sh file."
791 rm -f $mydir/test.sh || exit 1
792 rm -f $mydir/uninstall.sh || exit 1
795 writeUninstallFile() {
796 uninstallFile=$mydir/uninstall.sh
797 echo '#!/bin/bash' > $uninstallFile || exit 1
798 echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $uninstallFile || exit 1
799 echo "\$mydir/install.sh \\" >> $uninstallFile || exit 1
800 echo " --uninstall \\" >> $uninstallFile || exit 1
801 echo " --catalogManager=$myCatalogManager \\" >> $uninstallFile || exit 1
802 echo " --dotEmacs='$myEmacsFile' \\" >> $uninstallFile || exit 1
803 echo ' $@' >> $uninstallFile || exit 1
804 chmod 755 $uninstallFile || exit 1
808 testFile=$mydir/test.sh
809 echo "#!/bin/bash" > $testFile || exit 1
810 echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $testFile || exit 1
811 echo '$mydir/install.sh --test' >> $testFile || exit 1
812 chmod 755 $testFile || exit 1
817 To source your shell environment for this distribution, type the
826 resolverResponse="$(java org.apache.xml.resolver.apps.resolver uri -u foo 2>/dev/null)"
827 if [ -z "$resolverResponse" ]; then
830 NOTE: Your environment does not seem to contain the Apache XML
831 Commons Resolver; without that, you can't use XML catalogs
832 with Java applications. For more information, see the "How
833 to use a catalog file" section in Bob Stayton's "DocBook
834 XSL: The Complete Guide"
836 http://sagehill.net/docbookxsl/UseCatalog.html
845 NOTE: No changes were made to CatalogManagers.properties. To
846 provide your Java tools with XML catalog information for
847 this distribution, you will need to make the appropriate
854 if [ ! -f "$thisXmlCatalog" ]; then
857 FATAL: $thisXmlCatalog file needed but not found. Stopping.
862 if [ -z "$XML_CATALOG_FILES" ]; then
864 emit_message "WARNING: XML_CATALOG_FILES not set. Not testing with xmlcatalog."
866 xmlCatalogResponse="$(xmlcatalog 2>/dev/null)"
867 if [ -z "$xmlCatalogResponse" ]; then
870 WARNING: Cannot locate the "xmlcatalog" command. Make sure that
871 you have libxml2 and its associated utilities installed.
877 emit_message "Testing with xmlcatalog..."
878 # read in pathname-uri pairs from .urilist file
880 if [ ! "${pair%* *}" = "." ]; then
881 path=$mydir/${pair%* *}
887 emit_message " Tested: $uri"
888 for catalog in $XML_CATALOG_FILES; do
889 response="$(xmlcatalog $catalog $uri| grep -v "No entry")"
890 if [ -n "$response" ]; then
891 if [ "$response" = "$path" ]; then
892 emit_message " Result: $path"
895 emit_message " Result: FAILED"
899 done < $mydir/.urilist
903 if [ -z "$CLASSPATH" ]; then
905 emit_message "NOTE: CLASSPATH not set. Not testing with Apache XML Commons Resolver."
907 if [ "$(checkForResolver)" ]; then
911 emit_message "Testing with Apache XML Commons Resolver..."
912 # read in pathname-uri pairs from .urilist file
914 if [ ! "${pair%* *}" = "." ]; then
915 path=$mydir/${pair%* *}
921 emit_message " Tested: $uri"
922 if [ ${uri%.dtd} != $uri ]; then
923 response="$(java org.apache.xml.resolver.apps.resolver system -s $uri | grep "Result")"
925 response="$(java org.apache.xml.resolver.apps.resolver uri -u $uri | grep "Result")"
927 if [ "$response" ]; then
928 if [ "${response#*$path}" != "$response" ]; then
929 emit_message " Result: $path"
931 emit_message " Result: FAILED"
935 done < $mydir/.urilist
940 # get opts and execute appropriate function
955 # Copyright 2005-2007 Michael(tm) Smith <smith@sideshowbarker.net>
957 # Permission is hereby granted, free of charge, to any person
958 # obtaining a copy of this software and associated documentation
959 # files (the "Software"), to deal in the Software without
960 # restriction, including without limitation the rights to use, copy,
961 # modify, merge, publish, distribute, sublicense, and/or sell copies
962 # of the Software, and to permit persons to whom the Software is
963 # furnished to do so, subject to the following conditions:
965 # The above copyright notice and this permission notice shall be
966 # included in all copies or substantial portions of the Software.
968 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
969 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
970 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
971 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
972 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
973 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
974 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
975 # DEALINGS IN THE SOFTWARE.