[2a26a4f5] | 1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
[afa7fb1] | 2 | <!DOCTYPE xsl:stylesheet [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[ded6ddd] | 6 |
|
---|
| 7 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 8 | version="1.0">
|
---|
| 9 |
|
---|
[a9e89d0] | 10 | <xsl:output method="text"/>
|
---|
[ded6ddd] | 11 |
|
---|
[dcb91d8] | 12 | <!-- Allow select the dest dir at runtime -->
|
---|
| 13 | <xsl:param name="dest.dir">
|
---|
[0f7d4cb] | 14 | <xsl:value-of select="concat('/srv/www/', substring-after('&patches-root;', 'https://'))"/>
|
---|
[afa7fb1] | 15 | </xsl:param>
|
---|
[07f719a] | 16 |
|
---|
| 17 | <xsl:template match="/">
|
---|
[3bf7cb6] | 18 | <xsl:text>#! /bin/bash
|
---|
| 19 |
|
---|
| 20 | function copy
|
---|
| 21 | {
|
---|
| 22 | cp $1 $2 >>copyerrs 2>&1
|
---|
| 23 | }
|
---|
| 24 |
|
---|
[2a26a4f5] | 25 | umask 002
|
---|
[2159d60] | 26 |
|
---|
[2a26a4f5] | 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>
|
---|
[dcb91d8] | 32 | <xsl:value-of select="$dest.dir"/>
|
---|
[2a26a4f5] | 33 | <xsl:text> &&
|
---|
| 34 | cd </xsl:text>
|
---|
[dcb91d8] | 35 | <xsl:value-of select="$dest.dir"/>
|
---|
[2a26a4f5] | 36 | <xsl:text> &&
|
---|
| 37 | rm -f *.patch copyerrs &&
|
---|
| 38 |
|
---|
| 39 | </xsl:text>
|
---|
[07f719a] | 40 | <xsl:apply-templates/>
|
---|
[3bf7cb6] | 41 | <xsl:text>
|
---|
[2a26a4f5] | 42 | chgrp lfswww *.patch &&
|
---|
[3bf7cb6] | 43 | if [ `wc -l copyerrs | sed 's/ *//' | cut -f1 -d' '` -gt 0 ]; then
|
---|
[7a8a136] | 44 | mail -s "Missing LFS patches" lfs-book@lists.linuxfromscratch.org < copyerrs
|
---|
[2a26a4f5] | 45 | fi
|
---|
[2159d60] | 46 |
|
---|
[2a26a4f5] | 47 | exit
|
---|
| 48 | </xsl:text>
|
---|
[07f719a] | 49 | </xsl:template>
|
---|
| 50 |
|
---|
[dcb91d8] | 51 | <xsl:template match="//text()"/>
|
---|
[ded6ddd] | 52 |
|
---|
[a9e89d0] | 53 | <xsl:template match="//ulink">
|
---|
[872a378] | 54 | <!-- Match only local patch links and skip duplicated URLs split for PDF output-->
|
---|
[2159d60] | 55 | <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
|
---|
[dcb91d8] | 56 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 57 | <xsl:variable name="patch.name" select="substring-after(@url, '&patches-root;')"/>
|
---|
[2159d60] | 58 | <xsl:variable name="cut"
|
---|
[dcb91d8] | 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>
|
---|
[2159d60] | 65 | <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads/</xsl:text>
|
---|
[2a26a4f5] | 66 | <xsl:value-of select="substring-before($patch.name2, '-0')"/>
|
---|
[dcb91d8] | 67 | <xsl:text>/</xsl:text>
|
---|
| 68 | <xsl:value-of select="$patch.name"/>
|
---|
[2a26a4f5] | 69 | <xsl:text> .
|
---|
| 70 | </xsl:text>
|
---|
[a9e89d0] | 71 | </xsl:if>
|
---|
| 72 | </xsl:template>
|
---|
[ded6ddd] | 73 |
|
---|
| 74 | </xsl:stylesheet>
|
---|