Changeset 96d7e44


Ignore:
Timestamp:
08/14/2019 10:32:59 AM (5 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
0a0b609
Parents:
c992876
Message:

BLFS/xsl: move the template for replaceable tags out of the main stylesheet,
and allow replacing some hostname/domainname replaceable tags

Location:
BLFS
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • BLFS/gen_pkg_book.sh

    rc992876 r96d7e44  
    217217         --stringparam list-stat "$LIST_STAT" \
    218218         --stringparam language "$LANGUAGE" \
     219         --stringparam fqdn "$(hostname -f)" \
    219220         -o ./scripts/ ${MakeScripts} \
    220221         ${BookXml}
  • BLFS/xsl/scripts.xsl

    rc992876 r96d7e44  
    3535  <!-- Build as user (y) or as root (n)? -->
    3636  <xsl:param name="sudo" select="'y'"/>
    37 
    38   <!-- Localization in the form ll_CC.charmap@modifier (to be used in
    39        bash shell startup scripts). ll, CC, and charmap must be present:
    40        no way to use "C" or "POSIX". -->
    41   <xsl:param name="language" select="'en_US.UTF-8'"/>
    42 
    43   <!-- Break it in pieces -->
    44   <xsl:variable name="lang-ll">
    45     <xsl:copy-of select="substring-before($language,'_')"/>
    46   </xsl:variable>
    47   <xsl:variable name="lang-CC">
    48      <xsl:copy-of
    49             select="substring-before(substring-after($language,'_'),'.')"/>
    50   </xsl:variable>
    51   <xsl:variable name="lang-charmap">
    52     <xsl:choose>
    53       <xsl:when test="contains($language,'@')">
    54          <xsl:copy-of
    55                select="substring-before(substring-after($language,'.'),'@')"/>
    56       </xsl:when>
    57       <xsl:otherwise>
    58         <xsl:copy-of select="substring-after($language,'.')"/>
    59       </xsl:otherwise>
    60     </xsl:choose>
    61   </xsl:variable>
    62   <xsl:variable name="lang-modifier">
    63     <xsl:choose>
    64       <xsl:when test="contains($language,'@')">
    65          <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
    66       </xsl:when>
    67       <xsl:otherwise>
    68         <xsl:copy-of select="''"/>
    69       </xsl:otherwise>
    70     </xsl:choose>
    71   </xsl:variable>
    7237
    7338<!-- simple instructions for removing .la files. -->
     
    9358     role="install" sect2 -->
    9459  <xsl:include href="process-install.xsl"/>
     60
     61<!-- include the template for replaceable tags -->
     62  <xsl:include href="process-replaceable.xsl"/>
    9563
    9664<!--=================== Begin processing ========================-->
     
    812780  </xsl:template>
    813781
    814   <xsl:template match="replaceable">
    815     <xsl:choose>
    816 <!-- When adding a user to a group, the book uses "username" in a replaceable
    817      tag. Replace by the user name only if not running as root -->
    818       <xsl:when test="contains(string(),'username') and $sudo='y'">
    819         <xsl:text>$USER</xsl:text>
    820       </xsl:when>
    821 <!-- The next three entries are for gpm. I guess those settings are OK
    822      for a laptop or desktop. -->
    823       <xsl:when test="contains(string(),'yourprotocol')">
    824         <xsl:text>imps2</xsl:text>
    825       </xsl:when>
    826       <xsl:when test="contains(string(),'yourdevice')">
    827         <xsl:text>/dev/input/mice</xsl:text>
    828       </xsl:when>
    829       <xsl:when test="contains(string(),'additional options')"/>
    830 <!-- the book has four fields for language. The language param is
    831      broken into four pieces above. We use the results here. -->
    832       <xsl:when test="contains(string(),'&lt;ll&gt;')">
    833         <xsl:copy-of select="$lang-ll"/>
    834       </xsl:when>
    835       <xsl:when test="contains(string(),'&lt;CC&gt;')">
    836         <xsl:copy-of select="$lang-CC"/>
    837       </xsl:when>
    838       <xsl:when test="contains(string(),'&lt;charmap&gt;')">
    839         <xsl:copy-of select="$lang-charmap"/>
    840       </xsl:when>
    841       <xsl:when test="contains(string(),'@modifier')">
    842         <xsl:copy-of select="$lang-modifier"/>
    843       </xsl:when>
    844 <!-- At several places, the number of jobs is given as "N" in a replaceable
    845      tag. We either detect "N" alone or &lt;N&gt; Replace N with 4. -->
    846       <xsl:when test="contains(string(),'&lt;N&gt;') or string()='N'">
    847         <xsl:text>4</xsl:text>
    848       </xsl:when>
    849 <!-- Mercurial config file uses user_name. Replace only if non root.
    850      Add a bogus mail field. That works for the proposed tests anyway. -->
    851       <xsl:when test="contains(string(),'user_name') and $sudo='y'">
    852         <xsl:text>$USER ${USER}@mail.bogus</xsl:text>
    853       </xsl:when>
    854 <!-- Use the config for Gtk+3 as is -->
    855       <xsl:when test="ancestor::sect1[@id='gtk3']">
    856         <xsl:copy-of select="string()"/>
    857       </xsl:when>
    858 <!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
    859       <xsl:when test="contains(string(),'RAM_Installed')">
    860         <xsl:text>1024</xsl:text>
    861       </xsl:when>
    862       <xsl:otherwise>
    863         <xsl:text>**EDITME</xsl:text>
    864         <xsl:apply-templates/>
    865         <xsl:text>EDITME**</xsl:text>
    866       </xsl:otherwise>
    867     </xsl:choose>
    868   </xsl:template>
    869 
    870   <xsl:template match="replaceable" mode="root">
    871     <xsl:apply-templates select="."/>
    872   </xsl:template>
    873 
    874782  <xsl:template name="output-destdir">
    875783    <xsl:apply-templates
Note: See TracChangeset for help on using the changeset viewer.