1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [
|
---|
3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
4 | %general-entities;
|
---|
5 | ]>
|
---|
6 |
|
---|
7 | <!--
|
---|
8 | $LastChangedBy$
|
---|
9 | $Date$
|
---|
10 | -->
|
---|
11 |
|
---|
12 | <!--
|
---|
13 | This stylesheet creates a script to copy the patches referenced
|
---|
14 | in the BLFS book from the patches repository to the blfs
|
---|
15 | download area. It is very specific to the installation on
|
---|
16 | the home server.
|
---|
17 | -->
|
---|
18 |
|
---|
19 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
20 | version="1.0">
|
---|
21 |
|
---|
22 | <xsl:output method="text"/>
|
---|
23 |
|
---|
24 | <!-- Allow select the dest dir at runtime -->
|
---|
25 | <xsl:param name="dest.dir">
|
---|
26 | <xsl:value-of select="concat('/srv/www/', substring-after('&patch-root;', 'http://'))"/>
|
---|
27 | </xsl:param>
|
---|
28 |
|
---|
29 | <xsl:template match="/">
|
---|
30 | <xsl:text>#! /bin/bash

</xsl:text>
|
---|
31 | <xsl:text>function copy
|
---|
32 | {
|
---|
33 | cp $1 $2 >>copyerrs 2>&1
|
---|
34 | }

</xsl:text>
|
---|
35 | <!-- Create dest.dir if it don't exist -->
|
---|
36 | <xsl:text>mkdir -p </xsl:text>
|
---|
37 | <xsl:value-of select="$dest.dir"/>
|
---|
38 | <xsl:text> &&
</xsl:text>
|
---|
39 | <xsl:text>cd </xsl:text>
|
---|
40 | <xsl:value-of select="$dest.dir"/>
|
---|
41 | <xsl:text> &&

</xsl:text>
|
---|
42 | <!-- Remove old patches and possible list of missing patches-->
|
---|
43 | <xsl:text>rm -f *.patch copyerrs &&

</xsl:text>
|
---|
44 | <xsl:apply-templates/>
|
---|
45 | <!-- Ensure correct ownership -->
|
---|
46 | <xsl:text>
chgrp lfswww *.patch &&
</xsl:text>
|
---|
47 | <xsl:text>if [ `wc -l copyerrs|sed 's/ *//' |cut -f1 -d' '` -gt 0 ]; then
|
---|
48 | mail -s "Missing BLFS patches" blfs-book@linuxfromscratch.org < copyerrs
|
---|
49 | fi</xsl:text>
|
---|
50 | <xsl:text>
exit
</xsl:text>
|
---|
51 | </xsl:template>
|
---|
52 |
|
---|
53 | <xsl:template match="//text()"/>
|
---|
54 |
|
---|
55 | <xsl:template match="//ulink">
|
---|
56 | <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
|
---|
57 | <xsl:if test="contains(@url, '.patch') and contains(@url, '&patch-root;')
|
---|
58 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
59 | <xsl:variable name="patch.name" select="substring-after(@url, '&patch-root;')"/>
|
---|
60 | <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads</xsl:text>
|
---|
61 | <xsl:choose>
|
---|
62 | <!-- cdparanoia -->
|
---|
63 | <xsl:when test="contains($patch.name, '-III')">
|
---|
64 | <xsl:text>/cdparanoia</xsl:text>
|
---|
65 | </xsl:when>
|
---|
66 | <!-- Open Office -->
|
---|
67 | <xsl:when test="contains($patch.name, 'OOo')">
|
---|
68 | <xsl:text>/OOo</xsl:text>
|
---|
69 | </xsl:when>
|
---|
70 | <!-- QT -->
|
---|
71 | <xsl:when test="contains($patch.name, 'qt-x')">
|
---|
72 | <xsl:text>/qt</xsl:text>
|
---|
73 | </xsl:when>
|
---|
74 | <!-- XOrg -->
|
---|
75 | <xsl:when test="contains($patch.name, 'X11R6')">
|
---|
76 | <xsl:text>/xorg</xsl:text>
|
---|
77 | </xsl:when>
|
---|
78 | <!-- net-tools -->
|
---|
79 | <xsl:when test="contains($patch.name, 'net-tools')">
|
---|
80 | <xsl:text>/net-tools</xsl:text>
|
---|
81 | </xsl:when>
|
---|
82 | <!-- x265 -->
|
---|
83 | <xsl:when test="contains($patch.name, 'x265')">
|
---|
84 | <xsl:text>/x265</xsl:text>
|
---|
85 | </xsl:when>
|
---|
86 | <!-- General rule -->
|
---|
87 | <xsl:otherwise>
|
---|
88 | <xsl:variable name="cut"
|
---|
89 | select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
|
---|
90 | <xsl:variable name="patch.name2">
|
---|
91 | <xsl:value-of select="substring-before($patch.name, '-')"/>
|
---|
92 | <xsl:text>-</xsl:text>
|
---|
93 | <xsl:value-of select="$cut"/>
|
---|
94 | </xsl:variable>
|
---|
95 | <xsl:value-of select="substring-before($patch.name2, '-0')"/>
|
---|
96 | </xsl:otherwise>
|
---|
97 | </xsl:choose>
|
---|
98 | <xsl:value-of select="$patch.name"/>
|
---|
99 | <xsl:text> . 
</xsl:text>
|
---|
100 | </xsl:if>
|
---|
101 | </xsl:template>
|
---|
102 |
|
---|
103 | </xsl:stylesheet>
|
---|
104 |
|
---|