Ignore:
Timestamp:
08/24/2016 03:15:14 PM (8 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
new_features
Children:
013a0bc
Parents:
df42c7c
Message:

BLFS porg style package management:

  • update envarc.conf so that the system is made aware of the wrapInstall

and packInstall functions

  • update scripts.xsl for wrapping install commands
  • update gen_config.xsl to add the variable WRAP_INSTALL
  • use the variable WRAP_INSTALL in gen_pkg_book

TODO: install the correct pack - wrap functions when installing BLFS tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/xsl/scripts.xsl

    rdf42c7c re234d23  
    99
    1010<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
     11
     12  <!-- Wrap "root" commands inside a wrapper function, allowing
     13       "porg style" package management -->
     14  <xsl:param name="wrap-install" select="'n'"/>
    1115
    1216  <!-- Build as user (y) or as root (n)? -->
     
    5862          <!-- Package page -->
    5963          <xsl:when test="sect2[@role='package']">
    60             <!-- We build in a subdirectory -->
    61             <xsl:text>PKG_DIR=</xsl:text>
     64            <!-- We build in a subdirectory, whose name may be needed
     65                 if using package management (see envars.conf), so
     66                 "export" it -->
     67            <xsl:text>export PKG_DIR=</xsl:text>
    6268            <xsl:value-of select="$filename"/>
    6369            <xsl:text>&#xA;</xsl:text>
     
    125131     ;;
    126132esac
     133export UNPACKDIR
    127134cd $UNPACKDIR&#xA;
    128135</xsl:text>
     
    381388      <xsl:choose>
    382389        <xsl:when test="@role = 'root'">
    383           <xsl:if test="$sudo = 'y'">
    384             <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
     390          <xsl:if test="not(preceding-sibling::screen[@role='root'])">
     391            <xsl:if test="$sudo = 'y'">
     392              <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
     393            </xsl:if>
     394            <xsl:if test="$wrap-install = 'y' and
     395                          ancestor::sect2[@role='installation']">
     396              <xsl:text>if [ -r "$PACK_INSTALL" ]; then
     397  source $PACK_INSTALL
     398  export -f wrapInstall
     399  export -f packInstall
     400fi
     401wrapInstall '
     402</xsl:text>
     403            </xsl:if>
    385404          </xsl:if>
    386405          <xsl:apply-templates mode="root"/>
    387           <xsl:if test="$sudo = 'y'">
    388             <xsl:text>&#xA;ROOT_EOF</xsl:text>
     406          <xsl:if test="not(following-sibling::screen[@role='root'])">
     407            <xsl:if test="$wrap-install = 'y' and
     408                          ancestor::sect2[@role='installation']">
     409              <xsl:text>'&#xA;packInstall</xsl:text>
     410            </xsl:if>
     411            <xsl:if test="$sudo = 'y'">
     412              <xsl:text>&#xA;ROOT_EOF</xsl:text>
     413            </xsl:if>
    389414          </xsl:if>
    390415        </xsl:when>
     
    463488  </xsl:template>
    464489
     490  <xsl:variable name="APOS">'</xsl:variable>
     491
    465492  <xsl:template name="output-root">
    466493    <xsl:param name="out-string" select="''"/>
     
    510537        </xsl:call-template>
    511538      </xsl:when>
     539      <xsl:when test="contains($out-string,string($APOS))
     540                      and $wrap-install = 'y'">
     541        <xsl:call-template name="output-root">
     542          <xsl:with-param name="out-string"
     543                          select="substring-before($out-string,string($APOS))"/>
     544        </xsl:call-template>
     545        <xsl:text>'\''</xsl:text>
     546        <xsl:call-template name="output-root">
     547          <xsl:with-param name="out-string"
     548                          select="substring-after($out-string,string($APOS))"/>
     549        </xsl:call-template>
     550      </xsl:when>
    512551      <xsl:otherwise>
    513552        <xsl:value-of select="$out-string"/>
Note: See TracChangeset for help on using the changeset viewer.