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

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

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

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

</xsl:text>
|
---|
[967e951] | 44 | <xsl:apply-templates/>
|
---|
[bce3ed57] | 45 | <!-- Ensure correct ownership -->
|
---|
| 46 | <xsl:text>
chgrp lfswww *.patch &&
</xsl:text>
|
---|
[6091daf] | 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
|
---|
[bce3ed57] | 49 | fi</xsl:text>
|
---|
| 50 | <xsl:text>
exit
</xsl:text>
|
---|
[71fc777d] | 51 | </xsl:template>
|
---|
| 52 |
|
---|
[967e951] | 53 | <xsl:template match="//text()"/>
|
---|
| 54 |
|
---|
[71fc777d] | 55 | <xsl:template match="//ulink">
|
---|
[967e951] | 56 | <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
|
---|
[6091daf] | 57 | <xsl:if test="contains(@url, '.patch') and contains(@url, '&patch-root;')
|
---|
[967e951] | 58 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 59 | <xsl:variable name="patch.name" select="substring-after(@url, '&patch-root;')"/>
|
---|
[b0965de] | 60 | <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads</xsl:text>
|
---|
[967e951] | 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>
|
---|
[8b55d031] | 77 | </xsl:when>
|
---|
| 78 | <!-- net-tools -->
|
---|
| 79 | <xsl:when test="contains($patch.name, 'net-tools')">
|
---|
| 80 | <xsl:text>/net-tools</xsl:text>
|
---|
[967e951] | 81 | </xsl:when>
|
---|
| 82 | <!-- General rule -->
|
---|
| 83 | <xsl:otherwise>
|
---|
[6091daf] | 84 | <xsl:variable name="cut"
|
---|
[967e951] | 85 | select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
|
---|
| 86 | <xsl:variable name="patch.name2">
|
---|
| 87 | <xsl:value-of select="substring-before($patch.name, '-')"/>
|
---|
| 88 | <xsl:text>-</xsl:text>
|
---|
| 89 | <xsl:value-of select="$cut"/>
|
---|
| 90 | </xsl:variable>
|
---|
| 91 | <xsl:value-of select="substring-before($patch.name2, '-0')"/>
|
---|
| 92 | </xsl:otherwise>
|
---|
| 93 | </xsl:choose>
|
---|
| 94 | <xsl:value-of select="$patch.name"/>
|
---|
| 95 | <xsl:text> . 
</xsl:text>
|
---|
[71fc777d] | 96 | </xsl:if>
|
---|
| 97 | </xsl:template>
|
---|
| 98 |
|
---|
[2555778] | 99 | </xsl:stylesheet>
|
---|
| 100 |
|
---|