buildDocBookCatalog revision 05d39112d410ca54c39c864afe613cb0fc03c465
1#!/bin/sh 2if [ ! -d /etc/xml -a -w /etc ] 3then 4 echo Directory /etc/xml missing creating it 5 mkdir /etc/xml 6 chmod 755 /etc/xml 7fi 8if [ -w /etc/xml/catalog -a -w /etc/xml ] 9then 10 ROOTCATALOG=/etc/xml/catalog 11 CATALOG=/etc/xml/docbook 12else 13 echo Unable to update root catalog /etc/xml/catalog 14 echo Using $HOME/xmlcatalog as the root catalog 15 echo export XMLCATALOG=$HOME/xmlcatalog 16 ROOTCATALOG=$HOME/xmlcatalog 17 CATALOG=$HOME/dbkxmlcatalog 18fi 19 20# 21# create the catalogs root and docbook specific 22# 23if [ ! -r $ROOTCATALOG ] ; then 24 echo creating XML Catalog root $ROOTCATALOG 25 /usr/bin/xmlcatalog --noout --create $ROOTCATALOG 26fi 27if [ ! -r $ROOTCATALOG ] ; then 28 echo Failed creating XML Catalog root $ROOTCATALOG 29 exit 1 30fi 31if [ ! -r $CATALOG ] ; then 32 echo creating DocBook XML Catalog $CATALOG 33 /usr/bin/xmlcatalog --noout --create $CATALOG 34fi 35if [ ! -r $CATALOG ] ; then 36 echo Failed creating DocBook XML Catalog $CATALOG 37 exit 1 38fi 39 40# 41# find the prefix for DocBook DTD 42# 43found=`find /usr/share/xml -name docbookx.dtd` 44if [ "$found" = "" ] ; then 45 found=`find $HOME -name docbookx.dtd` 46fi 47if [ "$found" = "" ] ; then 48 found=`find /usr/local -name docbookx.dtd` 49fi 50if [ "$found" = "" ] ; then 51 found=`find /usr/share/sgml -name docbookx.dtd` 52fi 53if [ "$found" = "" ] ; then 54 echo could not locate docbookx.dtd drom DocBook XML 55 exit 1 56fi 57 58dtd421="" 59for dtd in $found; do 60 check=`grep '//OASIS//DTD DocBook XML V4.1.2//EN' $dtd` 61 if [ "$check" != "" ] ; then 62 dtd421=$dtd 63 break 64 fi 65done 66 67if [ "$dtd421" = "" ] ; then 68 echo could not locate version 4.1.2 of DocBook XML 69 exit 1 70fi 71 72docbookdir=`dirname $dtd421` 73echo Found DocBook XML 4.1.2 DTD in $docbookdir 74if [ ! -w $docbookdir ] ; then 75 echo Cannot write to $docbookdir 76 exit 2 77fi 78 79xmlcatalog --noout --add "public" \ 80 "-//OASIS//ELEMENTS DocBook XML Information Pool V4.1.2//EN" \ 81 "file://$docbookdir/dbpoolx.mod" $CATALOG 82xmlcatalog --noout --add "public" \ 83 "-//OASIS//DTD DocBook XML V4.1.2//EN" \ 84 "file://$docbookdir/docbookx.dtd" $CATALOG 85xmlcatalog --noout --add "public" \ 86 "-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN" \ 87 "file://$docbookdir/dbcentx.mod" $CATALOG 88xmlcatalog --noout --add "public" \ 89 "-//OASIS//ENTITIES DocBook XML Notations V4.1.2//EN" \ 90 "file://$docbookdir/dbnotnx.mod" $CATALOG 91xmlcatalog --noout --add "public" \ 92 "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.1.2//EN" \ 93 "file://$docbookdir/dbgenent.mod" $CATALOG 94xmlcatalog --noout --add "public" \ 95 "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.1.2//EN" \ 96 "file://$docbookdir/dbhierx.mod" $CATALOG 97xmlcatalog --noout --add "public" \ 98 "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \ 99 "file://$docbookdir/soextblx.dtd" $CATALOG 100xmlcatalog --noout --add "public" \ 101 "-//OASIS//DTD DocBook XML CALS Table Model V4.1.2//EN" \ 102 "file://$docbookdir/calstblx.dtd" $CATALOG 103xmlcatalog --noout --add "rewriteSystem" \ 104 "http://www.oasis-open.org/docbook/xml/4.1.2" \ 105 "file://$docbookdir" $CATALOG 106xmlcatalog --noout --add "rewriteURI" \ 107 "http://www.oasis-open.org/docbook/xml/4.1.2" \ 108 "file://$docbookdir" $CATALOG 109 110xmlcatalog --noout --add "delegatePublic" \ 111 "-//OASIS//ENTITIES DocBook XML" \ 112 "file://$CATALOG" $ROOTCATALOG 113xmlcatalog --noout --add "delegatePublic" \ 114 "-//OASIS//DTD DocBook XML" \ 115 "file://$CATALOG" $ROOTCATALOG 116xmlcatalog --noout --add "delegateSystem" \ 117 "http://www.oasis-open.org/docbook/" \ 118 "file://$CATALOG" $ROOTCATALOG 119xmlcatalog --noout --add "delegateURI" \ 120 "http://www.oasis-open.org/docbook/" \ 121 "file://$CATALOG" $ROOTCATALOG 122 123# 124# find the prefix for ISO DocBook entities 125# 126top=`dirname $docbookdir` 127found=`find $top -name iso-amsb.ent` 128if [ "$found" = "" ] ; then 129 found=`find /usr/share/xml -name iso-amsb.ent` 130fi 131if [ "$found" = "" ] ; then 132 found=`find $HOME -name iso-amsb.ent` 133fi 134if [ "$found" = "" ] ; then 135 found=`find /usr/local -name iso-amsb.ent` 136fi 137if [ "$found" = "" ] ; then 138 found=`find /usr/share/sgml -name iso-amsb.ent` 139fi 140if [ "$found" = "" ] ; then 141 echo could not locate iso-amsb.ent of ISO DocBook entities 142 exit 1 143fi 144 145entxml="" 146for tst in $found; do 147 check=`grep '<!ENTITY ominus."\⊖">' $tst` 148 if [ "$check" != "" ] ; then 149 entxml=$tst 150 break 151 fi 152done 153 154if [ "$entxml" = "" ] ; then 155 echo could not locate ISO DocBook entities 156 exit 1 157fi 158isodir=`dirname $entxml` 159echo Found ISO DocBook entities in $isodir 160 161xmlcatalog --noout --add "public" \ 162 "ISO 8879:1986//ENTITIES Publishing//EN" \ 163 "file://$isodir/iso-pub.ent" $CATALOG 164xmlcatalog --noout --add "public" \ 165 "ISO 8879:1986//ENTITIES Greek Letters//EN" \ 166 "file://$isodir/iso-grk1.ent" $CATALOG 167xmlcatalog --noout --add "public" \ 168 "ISO 8879:1986//ENTITIES Box and Line Drawing//EN" \ 169 "file://$isodir/iso-box.ent" $CATALOG 170xmlcatalog --noout --add "public" \ 171 "ISO 8879:1986//ENTITIES Greek Symbols//EN" \ 172 "file://$isodir/iso-grk3.ent" $CATALOG 173xmlcatalog --noout --add "public" \ 174 "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" \ 175 "file://$isodir/iso-amsn.ent" $CATALOG 176xmlcatalog --noout --add "public" \ 177 "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" \ 178 "file://$isodir/iso-num.ent" $CATALOG 179xmlcatalog --noout --add "public" \ 180 "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" \ 181 "file://$isodir/iso-grk4.ent" $CATALOG 182xmlcatalog --noout --add "public" \ 183 "ISO 8879:1986//ENTITIES Diacritical Marks//EN" \ 184 "file://$isodir/iso-dia.ent" $CATALOG 185xmlcatalog --noout --add "public" \ 186 "ISO 8879:1986//ENTITIES Monotoniko Greek//EN" \ 187 "file://$isodir/iso-grk2.ent" $CATALOG 188xmlcatalog --noout --add "public" \ 189 "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" \ 190 "file://$isodir/iso-amsa.ent" $CATALOG 191xmlcatalog --noout --add "public" \ 192 "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" \ 193 "file://$isodir/iso-amso.ent" $CATALOG 194xmlcatalog --noout --add "public" \ 195 "ISO 8879:1986//ENTITIES Russian Cyrillic//EN" \ 196 "file://$isodir/iso-cyr1.ent" $CATALOG 197xmlcatalog --noout --add "public" \ 198 "ISO 8879:1986//ENTITIES General Technical//EN" \ 199 "file://$isodir/iso-tech.ent" $CATALOG 200xmlcatalog --noout --add "public" \ 201 "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" \ 202 "file://$isodir/iso-amsc.ent" $CATALOG 203xmlcatalog --noout --add "public" \ 204 "ISO 8879:1986//ENTITIES Added Latin 1//EN" \ 205 "file://$isodir/iso-lat1.ent" $CATALOG 206xmlcatalog --noout --add "public" \ 207 "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" \ 208 "file://$isodir/iso-amsb.ent" $CATALOG 209xmlcatalog --noout --add "public" \ 210 "ISO 8879:1986//ENTITIES Added Latin 2//EN" \ 211 "file://$isodir/iso-lat2.ent" $CATALOG 212xmlcatalog --noout --add "public" \ 213 "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" \ 214 "file://$isodir/iso-amsr.ent" $CATALOG 215xmlcatalog --noout --add "public" \ 216 "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" \ 217 "file://$isodir/iso-cyr2.ent" $CATALOG 218 219xmlcatalog --noout --add "delegatePublic" \ 220 "ISO 8879:1986" \ 221 "file://$CATALOG" $ROOTCATALOG 222 223# 224# find the prefix for XSLT stylesheets 225# 226top=`dirname $docbookdir` 227found=`find $top -name chunk.xsl` 228if [ "$found" = "" ] ; then 229 found=`find /usr/share/xml -name chunk.xsl` 230fi 231if [ "$found" = "" ] ; then 232 found=`find $HOME -name chunk.xsl` 233fi 234if [ "$found" = "" ] ; then 235 found=`find /usr/local -name chunk.xsl` 236fi 237if [ "$found" = "" ] ; then 238 found=`find /usr/share/sgml -name chunk.xsl` 239fi 240if [ "$found" = "" ] ; then 241 echo could not locate chunk-common.xsl of DocBook XSLT stylesheets 242 exit 1 243fi 244 245xsldir="" 246for tst in $found; do 247 dir=`dirname $tst` 248 dir=`dirname $dir` 249 if [ -r $dir/html/docbook.xsl -a -r $dir/common/l10n.xml ]; then 250 xsldir=$dir 251 break 252 fi 253done 254 255if [ "$xsldir" = "" ] ; then 256 echo could not locate DocBook XSLT stylesheets 257 exit 1 258fi 259echo Found DocBook XSLT stylesheets in $xsldir 260for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \ 261 1.48 1.49 1.50 262do 263 xmlcatalog --noout --add "rewriteSystem" \ 264 "http://docbook.sourceforge.net/release/xsl/$version" \ 265 "file://$xsldir" $CATALOG 266 xmlcatalog --noout --add "rewriteURI" \ 267 "http://docbook.sourceforge.net/release/xsl/$version" \ 268 "file://$xsldir" $CATALOG 269done 270 271xmlcatalog --noout --add "delegateSystem" \ 272 "http://docbook.sourceforge.net/release/xsl/" \ 273 "file://$CATALOG" $ROOTCATALOG 274xmlcatalog --noout --add "delegateURI" \ 275 "http://docbook.sourceforge.net/release/xsl/" \ 276 "file://$CATALOG" $ROOTCATALOG 277 278# 279# 280