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 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
8 | version="1.0">
|
---|
9 |
|
---|
10 | <xsl:output method="text"/>
|
---|
11 |
|
---|
12 | <!-- Allow select the dest dir at runtime -->
|
---|
13 | <xsl:param name="dest.dir">
|
---|
14 | <xsl:value-of select="concat('/srv/www/', substring-after('&patches-root;', 'https://'))"/>
|
---|
15 | </xsl:param>
|
---|
16 |
|
---|
17 | <xsl:template match="/">
|
---|
18 | <xsl:text>#! /bin/bash
|
---|
19 |
|
---|
20 | function copy
|
---|
21 | {
|
---|
22 | cp $1 $2 >>copyerrs 2>&1
|
---|
23 | }
|
---|
24 |
|
---|
25 | umask 002
|
---|
26 |
|
---|
27 | # Create dest.dir if it doesn't exist
|
---|
28 | # Remove old patches
|
---|
29 | # Copy the patches
|
---|
30 | # Ensure correct ownership
|
---|
31 | install -d -m 775 -g lfswww </xsl:text>
|
---|
32 | <xsl:value-of select="$dest.dir"/>
|
---|
33 | <xsl:text> &&
|
---|
34 | cd </xsl:text>
|
---|
35 | <xsl:value-of select="$dest.dir"/>
|
---|
36 | <xsl:text> &&
|
---|
37 | rm -f *.patch copyerrs &&
|
---|
38 |
|
---|
39 | </xsl:text>
|
---|
40 | <xsl:apply-templates/>
|
---|
41 | <xsl:text>
|
---|
42 | chgrp lfswww *.patch &&
|
---|
43 | if [ `wc -l copyerrs | sed 's/ *//' | cut -f1 -d' '` -gt 0 ]; then
|
---|
44 | mail -s "Missing LFS patches" lfs-book@lists.linuxfromscratch.org < copyerrs
|
---|
45 | fi
|
---|
46 |
|
---|
47 | exit
|
---|
48 | </xsl:text>
|
---|
49 | </xsl:template>
|
---|
50 |
|
---|
51 | <xsl:template match="//text()"/>
|
---|
52 |
|
---|
53 | <xsl:template match="//ulink">
|
---|
54 | <!-- Match only local patch links and skip duplicated URLs split for PDF output-->
|
---|
55 | <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
|
---|
56 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
57 | <xsl:variable name="patch.name" select="substring-after(@url, '&patches-root;')"/>
|
---|
58 | <xsl:variable name="cut"
|
---|
59 | select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
|
---|
60 | <xsl:variable name="patch.name2">
|
---|
61 | <xsl:value-of select="substring-before($patch.name, '-')"/>
|
---|
62 | <xsl:text>-</xsl:text>
|
---|
63 | <xsl:value-of select="$cut"/>
|
---|
64 | </xsl:variable>
|
---|
65 | <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads/</xsl:text>
|
---|
66 | <xsl:value-of select="substring-before($patch.name2, '-0')"/>
|
---|
67 | <xsl:text>/</xsl:text>
|
---|
68 | <xsl:value-of select="$patch.name"/>
|
---|
69 | <xsl:text> .
|
---|
70 | </xsl:text>
|
---|
71 | </xsl:if>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | </xsl:stylesheet>
|
---|