summaryrefslogtreecommitdiffstats
path: root/textproc/scrollkeeper/pkg-install
blob: add95fa381ce9e268543539e03c27dba8bc6488e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/bin/sh

if [ -n "${PACKAGE_BUILDING}" ]; then
    exit 0
fi

PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
export PATH

PREFIX=`xml2-config --prefix`
ROOTCATALOG=${PREFIX}/share/xml/catalog
CATALOG=${PREFIX}/share/xml/docbook/catalog

if [ "$2" = "PRE-INSTALL" ]; then
if [ -r $ROOTCATALOG ] ; then
   echo backing up XML Catalog root $ROOTCATALOG
   cp -f $ROOTCATALOG ${ROOTCATALOG}.bak
   rm -f $ROOTCATALOG
fi

if [ -r $CATALOG ] ; then
   echo backing up XML Catalog $CATALOG
   cp -f $CATALOG ${CATALOG}.bak
   rm -f $CATALOG
fi

#
# create the catalogs root and docbook specific
#
if [ ! -r $ROOTCATALOG ] ; then
   echo creating XML Catalog root $ROOTCATALOG
   xmlcatalog --noout --create $ROOTCATALOG
fi
if [ ! -r $ROOTCATALOG ] ; then
   echo Failed creating XML Catalog root $ROOTCATALOG
   exit 1
fi
if [ ! -r $CATALOG ] ; then
   echo creating DocBook XML Catalog $CATALOG
   xmlcatalog --noout --create $CATALOG
fi
if [ ! -r $CATALOG ] ; then
   echo Failed creating DocBook XML Catalog $CATALOG
   exit 1
fi

#
# find the prefix for DocBook DTD
#
found=`find ${PREFIX}/ -name docbookx.dtd 2> /dev/null`
if [ "$found" = "" ] ; then
    echo could not locate docbookx.dtd for DocBook XML
    exit 1
fi

dtd421=""
for dtd in $found; do
    check=`grep '//OASIS//DTD DocBook XML V4.2//EN' $dtd`
    if [ "$check" != "" ] ; then
        dtd421=$dtd
        break
    fi
done

if [ "$dtd421" = "" ] ; then
    echo could not locate version 4.2 of DocBook XML
    exit 1
fi

docbookdir=`dirname $dtd421`
echo Found DocBook XML 4.2 DTD in $docbookdir

xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Information Pool V4.2//EN" \
    "file://$docbookdir/dbpoolx.mod" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.2//EN" \
    "file://$docbookdir/docbookx.dtd" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Character Entities V4.2//EN" \
    "file://$docbookdir/dbcentx.mod" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Notations V4.2//EN" \
    "file://$docbookdir/dbnotnx.mod" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.2//EN" \
    "file://$docbookdir/dbgenent.mod" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.2//EN" \
    "file://$docbookdir/dbhierx.mod" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "file://$docbookdir/soextblx.dtd" $CATALOG
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML CALS Table Model V4.2//EN" \
    "file://$docbookdir/calstblx.dtd" $CATALOG
xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.2" \
    "file://$docbookdir" $CATALOG
xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.2" \
    "file://$docbookdir" $CATALOG

xmlcatalog --noout --add "delegatePublic" \
    "-//OASIS//ENTITIES DocBook XML" \
    "file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegatePublic" \
    "-//OASIS//DTD DocBook XML" \
    "file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateSystem" \
    "http://www.oasis-open.org/docbook/" \
    "file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateURI" \
    "http://www.oasis-open.org/docbook/" \
    "file://$CATALOG" $ROOTCATALOG

#
# find the prefix for ISO DocBook entities
#
top=`dirname $docbookdir`
found=`find $top -iname "iso*amsb.ent" 2> /dev/null`
found=`find ${PREFIX}/ -iname "iso*amsb.ent" 2> /dev/null`
if [ "$found" = "" ] ; then
    echo could not locate iso-amsb.ent of ISO DocBook entities
    exit 1
fi

entxml=""
for tst in $found; do
    check=`grep '<!ENTITY ominus."\&#x2296;">' $tst`
    if [ "$check" != "" ] ; then
        entxml=$tst
        break
    fi
done

if [ "$entxml" = "" ] ; then
    echo could not locate ISO DocBook entities
    exit 1
fi
isodir=`dirname $entxml`
echo Found ISO DocBook entities in $isodir

xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Publishing//EN" \
    "file://$isodir/iso-pub.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Greek Letters//EN" \
    "file://$isodir/iso-grk1.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Box and Line Drawing//EN" \
    "file://$isodir/iso-box.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Greek Symbols//EN" \
    "file://$isodir/iso-grk3.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" \
    "file://$isodir/iso-amsn.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" \
    "file://$isodir/iso-num.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" \
    "file://$isodir/iso-grk4.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Diacritical Marks//EN" \
    "file://$isodir/iso-dia.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Monotoniko Greek//EN" \
    "file://$isodir/iso-grk2.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" \
    "file://$isodir/iso-amsa.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" \
    "file://$isodir/iso-amso.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Russian Cyrillic//EN" \
    "file://$isodir/iso-cyr1.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES General Technical//EN" \
    "file://$isodir/iso-tech.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" \
    "file://$isodir/iso-amsc.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Latin 1//EN" \
    "file://$isodir/iso-lat1.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" \
    "file://$isodir/iso-amsb.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Latin 2//EN" \
    "file://$isodir/iso-lat2.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" \
    "file://$isodir/iso-amsr.ent" $CATALOG
xmlcatalog --noout --add "public" \
    "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" \
    "file://$isodir/iso-cyr2.ent" $CATALOG

xmlcatalog --noout --add "delegatePublic" \
    "ISO 8879:1986" \
    "file://$CATALOG" $ROOTCATALOG

#
# find the prefix for XSLT stylesheets
#
top=`dirname $docbookdir`
found=`find $top -name chunk.xsl 2> /dev/null`
found=`find ${PREFIX}/ -name chunk.xsl 2> /dev/null`
if [ "$found" = "" ] ; then
    echo could not locate chunk-common.xsl of DocBook XSLT stylesheets
    exit 1
fi

xsldir=""
for tst in $found; do
    dir=`dirname $tst`
    dir=`dirname $dir`
    if [ -r $dir/html/docbook.xsl -a -r $dir/common/l10n.xml ]; then
        xsldir=$dir
        break
    fi
done

if [ "$xsldir" = "" ] ; then
    echo could not locate DocBook XSLT stylesheets
    exit 1
fi
echo Found DocBook XSLT stylesheets in $xsldir
for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \
               1.48 1.49 1.50 1.51 1.52 1.53 1.54 1.55
do
    xmlcatalog --noout --add "rewriteSystem" \
	"http://docbook.sourceforge.net/release/xsl/$version" \
	"file://$xsldir" $CATALOG
    xmlcatalog --noout --add "rewriteURI" \
	"http://docbook.sourceforge.net/release/xsl/$version" \
	"file://$xsldir" $CATALOG
done

xmlcatalog --noout --add "delegateSystem" \
    "http://docbook.sourceforge.net/release/xsl/" \
    "file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateURI" \
    "http://docbook.sourceforge.net/release/xsl/" \
    "file://$CATALOG" $ROOTCATALOG
fi

if [ "$2" = "POST-INSTALL" ]; then
    SKPREFIX=`scrollkeeper-config --prefix`
    echo "`date +"%b %d %X"` Installing ScrollKeeper `scrollkeeper-config --version`..." >> /var/log/scrollkeeper.log

    xmlcatalog --noout --add "public" \
    	"-//OMF//DTD Scrollkeeper OMF Variant V1.0//EN" \
	"${SKPREFIX}/share/gnome/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd" \
	${PREFIX}/share/xml/catalog

    scrollkeeper-rebuilddb -q -p /var/db/scrollkeeper || /usr/bin/true
fi
OpenPOWER on IntegriCloud