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