1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [
|
---|
3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
4 | %general-entities;
|
---|
5 | ]>
|
---|
6 |
|
---|
7 | <!--
|
---|
8 | This stylesheet creates a script to copy the patches referenced
|
---|
9 | in the BLFS book from the patches repository to the blfs
|
---|
10 | download area. It is very specific to the installation on
|
---|
11 | the home server.
|
---|
12 | -->
|
---|
13 |
|
---|
14 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
15 | version="1.0">
|
---|
16 |
|
---|
17 | <xsl:output method="text"/>
|
---|
18 |
|
---|
19 | <!-- Allow select the dest dir at runtime -->
|
---|
20 | <xsl:param name="dest.dir">
|
---|
21 | <xsl:value-of select="concat('/srv/www/', substring-after('&patch-root;', 'https://'))"/>
|
---|
22 | </xsl:param>
|
---|
23 |
|
---|
24 | <xsl:template match="/">
|
---|
25 | <xsl:text>#! /bin/bash
|
---|
26 |
|
---|
27 | function copy
|
---|
28 | {
|
---|
29 | cp $1 $2 >>copyerrs 2>&1
|
---|
30 | }
|
---|
31 |
|
---|
32 | # Create dest.dir if it doesn't exist
|
---|
33 | # Change to it
|
---|
34 | # Remove old patches and possible list of missing patches
|
---|
35 | # Ensure correct ownership
|
---|
36 |
|
---|
37 | mkdir -p </xsl:text>
|
---|
38 | <xsl:value-of select="$dest.dir"/>
|
---|
39 | <xsl:text> &&
|
---|
40 | cd </xsl:text>
|
---|
41 | <xsl:value-of select="$dest.dir"/>
|
---|
42 | <xsl:text> &&
|
---|
43 |
|
---|
44 | rm -f *.patch copyerrs &&
|
---|
45 |
|
---|
46 | </xsl:text>
|
---|
47 | <xsl:apply-templates/>
|
---|
48 | <xsl:text>
|
---|
49 | chgrp lfswww *.patch &&
|
---|
50 | if [ `wc -l copyerrs|sed 's/ *//' |cut -f1 -d' '` -gt 0 ]; then
|
---|
51 | mail -s "Missing BLFS patches" blfs-book@lists.linuxfromscratch.org < copyerrs
|
---|
52 | fi
|
---|
53 | exit</xsl:text>
|
---|
54 | </xsl:template>
|
---|
55 |
|
---|
56 | <xsl:template match="//text()"/>
|
---|
57 |
|
---|
58 | <xsl:template match="//ulink">
|
---|
59 | <!-- Match only local patches links and skip duplicated URLs split for PDF output-->
|
---|
60 | <xsl:if test="contains(@url, '.patch') and contains(@url, '&patch-root;')
|
---|
61 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
62 | <xsl:variable name="patch.name" select="substring-after(@url, '&patch-root;')"/>
|
---|
63 | <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads</xsl:text>
|
---|
64 | <xsl:choose>
|
---|
65 | <!-- cdparanoia -->
|
---|
66 | <xsl:when test="contains($patch.name, '-III')">
|
---|
67 | <xsl:text>/cdparanoia</xsl:text>
|
---|
68 | </xsl:when>
|
---|
69 | <!-- Open Office -->
|
---|
70 | <xsl:when test="contains($patch.name, 'OOo')">
|
---|
71 | <xsl:text>/OOo</xsl:text>
|
---|
72 | </xsl:when>
|
---|
73 | <!-- QT -->
|
---|
74 | <xsl:when test="contains($patch.name, 'qt-x')">
|
---|
75 | <xsl:text>/qt</xsl:text>
|
---|
76 | </xsl:when>
|
---|
77 | <!-- XOrg -->
|
---|
78 | <xsl:when test="contains($patch.name, 'X11R6')">
|
---|
79 | <xsl:text>/xorg</xsl:text>
|
---|
80 | </xsl:when>
|
---|
81 | <!-- net-tools -->
|
---|
82 | <xsl:when test="contains($patch.name, 'net-tools')">
|
---|
83 | <xsl:text>/net-tools</xsl:text>
|
---|
84 | </xsl:when>
|
---|
85 | <!-- junit -->
|
---|
86 | <xsl:when test="contains($patch.name, 'junit')">
|
---|
87 | <xsl:text>/junit</xsl:text>
|
---|
88 | </xsl:when>
|
---|
89 | <!-- x265 -->
|
---|
90 | <xsl:when test="contains($patch.name, 'x265')">
|
---|
91 | <xsl:text>/x265</xsl:text>
|
---|
92 | </xsl:when>
|
---|
93 | <!-- node -->
|
---|
94 | <xsl:when test="contains($patch.name, 'node')">
|
---|
95 | <xsl:text>/node</xsl:text>
|
---|
96 | </xsl:when>
|
---|
97 | <!-- nss -->
|
---|
98 | <xsl:when test="contains($patch.name, 'nss-standalone')">
|
---|
99 | <xsl:text>/nss</xsl:text>
|
---|
100 | </xsl:when>
|
---|
101 | <!-- General rule -->
|
---|
102 | <xsl:otherwise>
|
---|
103 | <xsl:variable name="cut"
|
---|
104 | select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
|
---|
105 | <xsl:variable name="patch.name2">
|
---|
106 | <xsl:value-of select="substring-before($patch.name, '-')"/>
|
---|
107 | <xsl:text>-</xsl:text>
|
---|
108 | <xsl:value-of select="$cut"/>
|
---|
109 | </xsl:variable>
|
---|
110 | <xsl:value-of select="substring-before($patch.name2, '-0')"/>
|
---|
111 | </xsl:otherwise>
|
---|
112 | </xsl:choose>
|
---|
113 | <xsl:value-of select="$patch.name"/>
|
---|
114 | <xsl:text> .
</xsl:text>
|
---|
115 | </xsl:if>
|
---|
116 | </xsl:template>
|
---|
117 |
|
---|
118 | </xsl:stylesheet>
|
---|
119 |
|
---|