source: BLFS/xsl/gen-install.xsl@ 8fb8ff2

ablfs-more legacy trunk
Last change on this file since 8fb8ff2 was 8fb8ff2, checked in by Pierre Labastie <pierre@…>, 5 years ago

Remove a spurious blank line in gen-install.xsl

  • Property mode set to 100644
File size: 9.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0">
5
6<!-- $Id$ -->
7
8 <xsl:template match="screen" mode="installation">
9<!-- "nature" variables:
10 - 'non-root': executable as user
11 - 'config': execute as root, with no special formatting
12 - 'install': execute as root, with PKG_DEST or escape instructions
13 - 'none': does not exist (for preceding of following uniquely)
14-->
15 <xsl:variable name="my-nature">
16 <xsl:choose>
17 <xsl:when test="not(@role)">
18 <xsl:text>non-root</xsl:text>
19 </xsl:when>
20 <xsl:when test="contains(string(),'useradd') or
21 contains(string(),'groupadd') or
22 contains(string(),'usermod') or
23 contains(string(),'icon-cache') or
24 contains(string(),'desktop-database') or
25 contains(string(),'compile-schemas') or
26 contains(string(),'query-loaders') or
27 contains(string(),'pam.d') or
28 contains(string(),'query-immodules')">
29 <xsl:text>config</xsl:text>
30 </xsl:when>
31 <xsl:otherwise>
32 <xsl:text>install</xsl:text>
33 </xsl:otherwise>
34 </xsl:choose>
35 </xsl:variable>
36
37 <xsl:variable
38 name="prec-string"
39 select="string(preceding-sibling::screen[not(@role='nodump') and
40 ./userinput][1])"/>
41<!--
42 <xsl:message>
43 <xsl:text>
44==============================
45List of preceding siblings for "</xsl:text>
46 <xsl:value-of select="./userinput"/>
47 <xsl:text>":
48</xsl:text>
49 <xsl:for-each select="preceding-sibling::screen[not(@role='nodump') and
50 ./userinput] |
51 preceding-sibling::para/command">
52 <xsl:copy-of select=".//text()"/>
53 <xsl:text>
54===
55</xsl:text>
56 </xsl:for-each>
57 </xsl:message>
58-->
59 <xsl:variable name="prec-nature">
60 <xsl:choose>
61 <xsl:when
62 test="$prec-string='' or
63 (preceding-sibling::screen[not(@role='nodump') and
64 ./userinput] |
65 preceding-sibling::para/command[contains(text(),'check') or
66 contains(text(),'test')]
67 )[last()][self::command]">
68 <xsl:text>none</xsl:text>
69 </xsl:when>
70 <xsl:when
71 test="preceding-sibling::screen
72 [not(@role='nodump') and ./userinput][1][not(@role)]">
73 <xsl:text>non-root</xsl:text>
74 </xsl:when>
75 <xsl:when test="contains($prec-string,'useradd') or
76 contains($prec-string,'groupadd') or
77 contains($prec-string,'usermod') or
78 contains($prec-string,'icon-cache') or
79 contains($prec-string,'desktop-database') or
80 contains($prec-string,'compile-schemas') or
81 contains($prec-string,'query-loaders') or
82 contains($prec-string,'pam.d') or
83 contains($prec-string,'query-immodules')">
84 <xsl:text>config</xsl:text>
85 </xsl:when>
86 <xsl:otherwise>
87 <xsl:text>install</xsl:text>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:variable>
91
92 <xsl:variable
93 name="follow-string"
94 select="string(following-sibling::screen[not(@role='nodump') and
95 ./userinput][1])"/>
96
97 <xsl:variable name="follow-nature">
98 <xsl:choose>
99 <xsl:when
100 test="$follow-string='' or
101 (following-sibling::screen[not(@role='nodump') and
102 ./userinput] |
103 following-sibling::para/command[contains(text(),'check') or
104 contains(text(),'test')]
105 )[1][self::command]">
106 <xsl:text>none</xsl:text>
107 </xsl:when>
108 <xsl:when
109 test="following-sibling::screen
110 [not(@role='nodump') and ./userinput][1][not(@role)]">
111 <xsl:text>non-root</xsl:text>
112 </xsl:when>
113 <xsl:when test="contains($follow-string,'useradd') or
114 contains($follow-string,'groupadd') or
115 contains($follow-string,'usermod') or
116 contains($follow-string,'icon-cache') or
117 contains($follow-string,'desktop-database') or
118 contains($follow-string,'compile-schemas') or
119 contains($follow-string,'query-loaders') or
120 contains($follow-string,'pam.d') or
121 contains($follow-string,'query-immodules')">
122 <xsl:text>config</xsl:text>
123 </xsl:when>
124 <xsl:otherwise>
125 <xsl:text>install</xsl:text>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:variable>
129
130 <xsl:choose>
131 <xsl:when test="$my-nature='non-root'">
132 <xsl:if test="$prec-nature='install'">
133 <xsl:call-template name="end-install"/>
134 <xsl:call-template name="end-root"/>
135 </xsl:if>
136 <xsl:if test="$prec-nature='config'">
137 <xsl:call-template name="end-root"/>
138 </xsl:if>
139 <xsl:apply-templates/>
140 <xsl:text>
141</xsl:text>
142 </xsl:when>
143
144 <xsl:when test="$my-nature='config'">
145 <xsl:if test="$prec-nature='none' or $prec-nature='non-root'">
146 <xsl:call-template name="begin-root"/>
147 </xsl:if>
148 <xsl:if test="$prec-nature='install'">
149 <xsl:call-template name="end-install"/>
150 </xsl:if>
151 <xsl:apply-templates mode="root"/>
152 <xsl:text>
153</xsl:text>
154 <xsl:if test="$follow-nature='none'">
155 <xsl:call-template name="end-root"/>
156 </xsl:if>
157 </xsl:when>
158
159 <xsl:when test="$my-nature='install'">
160 <xsl:if test="$prec-nature='none' or $prec-nature='non-root'">
161 <xsl:if test="contains($list-stat-norm,
162 concat(' ',ancestor::sect1/@id,' '))">
163 <xsl:call-template name="output-destdir"/>
164 </xsl:if>
165 <xsl:call-template name="begin-root"/>
166 <xsl:call-template name="begin-install"/>
167 </xsl:if>
168 <xsl:if test="$prec-nature='config'">
169 <xsl:if test="contains($list-stat-norm,
170 concat(' ',ancestor::sect1/@id,' '))">
171 <xsl:call-template name="end-root"/>
172 <xsl:call-template name="output-destdir"/>
173 <xsl:call-template name="begin-root"/>
174 </xsl:if>
175 <xsl:call-template name="begin-install"/>
176 </xsl:if>
177 <xsl:apply-templates mode="install"/>
178 <xsl:text>
179</xsl:text>
180 <xsl:if test="$follow-nature='none'">
181 <xsl:call-template name="end-install"/>
182 <xsl:call-template name="end-root"/>
183 </xsl:if>
184 </xsl:when>
185
186 </xsl:choose>
187 </xsl:template>
188
189 <xsl:template name="begin-root">
190 <xsl:if test="$sudo='y'">
191 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF
192</xsl:text>
193 </xsl:if>
194 </xsl:template>
195
196 <xsl:template name="begin-install">
197 <xsl:if test="$wrap-install = 'y'">
198 <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
199 source $JH_PACK_INSTALL
200 export -f wrapInstall
201 export -f packInstall
202fi
203wrapInstall '
204</xsl:text>
205 </xsl:if>
206 </xsl:template>
207
208 <xsl:template name="end-root">
209 <xsl:if test="$sudo='y'">
210 <xsl:text>ROOT_EOF
211</xsl:text>
212 </xsl:if>
213 </xsl:template>
214
215 <xsl:template name="end-install">
216 <xsl:if test="$del-la-files = 'y'">
217 <xsl:call-template name="output-root">
218 <xsl:with-param name="out-string" select="$la-files-instr"/>
219 </xsl:call-template>
220 </xsl:if>
221 <xsl:if test="$wrap-install = 'y'">
222 <xsl:text>'&#xA;packInstall&#xA;</xsl:text>
223 </xsl:if>
224 </xsl:template>
225
226 <xsl:template match="text()" mode="install">
227 <xsl:call-template name="output-install">
228 <xsl:with-param name="out-string" select="."/>
229 </xsl:call-template>
230 </xsl:template>
231
232 <xsl:template name="output-install">
233 <xsl:param name="out-string" select="''"/>
234 <xsl:choose>
235 <xsl:when test="contains($out-string,string($APOS))
236 and $wrap-install = 'y'">
237 <xsl:call-template name="output-root">
238 <xsl:with-param
239 name="out-string"
240 select="substring-before($out-string,string($APOS))"/>
241 </xsl:call-template>
242 <xsl:text>'\''</xsl:text>
243 <xsl:call-template name="output-install">
244 <xsl:with-param name="out-string"
245 select="substring-after($out-string,string($APOS))"/>
246 </xsl:call-template>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:call-template name="output-root">
250 <xsl:with-param name="out-string" select="."/>
251 </xsl:call-template>
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:template>
255
256</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.