Changeset d3d90e7


Ignore:
Timestamp:
06/15/2006 08:53:24 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
edf7e4c
Parents:
37ac06a
Message:

Added Some envars.
Better handled of packages download.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/libs/scripts.xsl

    r37ac06a rd3d90e7  
    7575        <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
    7676        <xsl:choose>
     77          <!-- Package page -->
    7778          <xsl:when test="sect2[@role='package']">
     79            <!-- Variables -->
     80            <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
     81            <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;&#xA;PACKAGE=</xsl:text>
     82            <xsl:value-of select="$package"/>
     83            <xsl:text>&#xA;PKG_DIR=</xsl:text>
     84            <xsl:value-of select="$ftpdir"/>
     85            <xsl:text>&#xA;&#xA;</xsl:text>
     86            <!-- Download code and build commands -->
    7887            <xsl:apply-templates select="sect2">
    7988              <xsl:with-param name="package" select="$package"/>
    8089              <xsl:with-param name="ftpdir" select="$ftpdir"/>
    8190            </xsl:apply-templates>
    82             <xsl:text>cd ~/sources/</xsl:text>
    83             <xsl:value-of select="$ftpdir"/>
    84             <xsl:text>&#xA;rm -rf $UNPACKDIR&#xA;&#xA;</xsl:text>
    85           </xsl:when>
     91            <!-- Clean-up -->
     92            <xsl:text>cd ~/sources/$PKG_DIR&#xA;</xsl:text>
     93            <xsl:text>rm -rf $UNPACKDIR&#xA;&#xA;</xsl:text>
     94          </xsl:when>
     95          <!-- Non-package page -->
    8696          <xsl:otherwise>
    8797            <xsl:apply-templates select=".//screen"/>
     
    101111    <xsl:choose>
    102112      <xsl:when test="@role = 'package'">
    103         <xsl:text>mkdir -p ~/sources/</xsl:text>
    104         <xsl:value-of select="$ftpdir"/>
    105         <xsl:text>&#xA;cd ~/sources/</xsl:text>
    106         <xsl:value-of select="$ftpdir"/>
    107         <xsl:text>&#xA;</xsl:text>
     113        <xsl:text>mkdir -p ~/sources/$PKG_DIR&#xA;</xsl:text>
     114        <xsl:text>cd ~/sources/$PKG_DIR&#xA;</xsl:text>
    108115        <xsl:apply-templates select="itemizedlist/listitem/para">
    109116          <xsl:with-param name="package" select="$package"/>
     
    113120      </xsl:when>
    114121      <xsl:when test="@role = 'installation'">
    115         <xsl:text>tar -xvf </xsl:text>
    116         <xsl:value-of select="$package"/>
    117         <xsl:text> > /tmp/unpacked&#xA;</xsl:text>
    118         <xsl:text>UNPACKDIR=`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'`&#xA;</xsl:text>
     122        <xsl:text>tar -xvf $PACKAGE > unpacked&#xA;</xsl:text>
     123        <xsl:text>UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`&#xA;</xsl:text>
    119124        <xsl:text>cd $UNPACKDIR&#xA;</xsl:text>
    120125        <xsl:apply-templates select=".//screen | .//para/command"/>
     
    125130        <xsl:text>&#xA;</xsl:text>
    126131      </xsl:when>
    127       <xsl:otherwise/>
    128132    </xsl:choose>
    129133  </xsl:template>
     
    191195    <xsl:param name="ftpdir" select="foo"/>
    192196    <xsl:choose>
     197      <!-- This depend on all package pages having both "Download HTTP" and "Download FTP" lines -->
    193198      <xsl:when test="contains(string(),'HTTP')">
     199        <xsl:text>if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
    194200        <!-- SRC_ARCHIVE may have subdirectories or not -->
    195         <xsl:text>cp $SRC_ARCHIVE/</xsl:text>
    196         <xsl:value-of select="$ftpdir"/>
    197         <xsl:text>/</xsl:text>
    198         <xsl:value-of select="$package"/>
    199         <xsl:text> || \&#xA;</xsl:text>
    200         <xsl:text>cp $SRC_ARCHIVE/</xsl:text>
    201         <xsl:value-of select="$package"/>
    202         <xsl:text> || \&#xA;</xsl:text>
     201        <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
     202        <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE&#xA;</xsl:text>
     203        <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then&#xA;</xsl:text>
     204        <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA;  else&#xA;</xsl:text>
    203205        <!-- The FTP_SERVER mirror -->
    204         <xsl:text>wget $FTP_SERVER/BLFS/conglomeration/</xsl:text>
    205         <xsl:value-of select="$ftpdir"/>
    206         <xsl:text>/</xsl:text>
    207         <xsl:value-of select="$package"/>
    208         <xsl:text> || \&#xA;</xsl:text>
     206        <xsl:text>    wget $FTP_SERVER/BLFS/conglomeration/$PKG_DIR/$PACKAGE || \&#xA;</xsl:text>
    209207        <!-- Upstream HTTP URL -->
    210         <xsl:text>wget </xsl:text>
     208        <xsl:text>    wget </xsl:text>
    211209        <xsl:value-of select="ulink/@url"/>
    212210        <xsl:text> || \&#xA;</xsl:text>
     
    214212      <xsl:when test="contains(string(),'FTP')">
    215213        <!-- Upstream FTP URL -->
    216         <xsl:text>wget </xsl:text>
     214        <xsl:text>    wget </xsl:text>
    217215        <xsl:value-of select="ulink/@url"/>
    218         <xsl:text>&#xA;</xsl:text>
     216        <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
    219217      </xsl:when>
    220218      <xsl:when test="contains(string(),'MD5')">
    221219        <xsl:text>echo "</xsl:text>
    222220        <xsl:value-of select="substring-after(string(),'sum: ')"/>
    223         <xsl:text>&#x20;&#x20;</xsl:text>
    224         <xsl:value-of select="$package"/>
    225         <xsl:text>" | md5sum -c -&#xA;</xsl:text>
     221        <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
    226222      </xsl:when>
    227223      <!-- Patches. Need be veryfied -->
     
    231227        <xsl:text>&#xA;</xsl:text>
    232228      </xsl:when>
    233       <xsl:otherwise/>
    234229    </xsl:choose>
    235230  </xsl:template>
Note: See TracChangeset for help on using the changeset viewer.