Changeset d8ddcfb for LFS/lfs.xsl


Ignore:
Timestamp:
03/05/2017 08:49:45 AM (8 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
new_features
Children:
e06a0d3
Parents:
deb6b6c
Message:

Fix the generation of scripts of
the networkd page (systemd book).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    rdeb6b6c rd8ddcfb  
    636636        </xsl:call-template>
    637637      </xsl:when>
     638      <xsl:when test="contains(string(),'[Match]')">
     639        <xsl:call-template name="outputsysdnet">
     640          <xsl:with-param name="netstring" select="string()"/>
     641        </xsl:call-template>
     642      </xsl:when>
    638643      <xsl:otherwise>
    639644        <xsl:apply-templates/>
     
    707712          <xsl:with-param name="netstring"
    708713                          select="substring-after($netstring,'24')"/>
     714        </xsl:call-template>
     715      </xsl:when>
     716      <xsl:otherwise>
     717        <xsl:value-of select="$netstring"/>
     718      </xsl:otherwise>
     719    </xsl:choose>
     720  </xsl:template>
     721
     722  <xsl:template name="outputsysdnet">
     723    <xsl:param name="netstring" select="''"/>
     724    <!-- We suppose that book example has the following values:
     725         - interface: eth0
     726         - ip: 192.168.0.2
     727         - gateway: 192.168.0.1
     728         - prefix: 24
     729         - DNS: 192.168.0.1
     730         - Domain: <Your Domain Name>
     731         and gateway comes before DNS. Change below if book changes -->
     732    <xsl:choose>
     733      <xsl:when test="contains($netstring,'eth0')">
     734        <xsl:call-template name="outputsysdnet">
     735          <xsl:with-param name="netstring"
     736                          select="substring-before($netstring,'eth0')"/>
     737        </xsl:call-template>
     738        <xsl:value-of select="$interface"/>
     739        <xsl:call-template name="outputsysdnet">
     740          <xsl:with-param name="netstring"
     741                          select="substring-after($netstring,'eth0')"/>
     742        </xsl:call-template>
     743      </xsl:when>
     744      <xsl:when test="contains($netstring,'192.168.0.1') and
     745                      contains($netstring,'Gateway')">
     746        <xsl:call-template name="outputsysdnet">
     747          <xsl:with-param name="netstring"
     748                          select="substring-before($netstring,'192.168.0.1')"/>
     749        </xsl:call-template>
     750        <xsl:value-of select="$gateway"/>
     751        <xsl:call-template name="outputsysdnet">
     752          <xsl:with-param name="netstring"
     753                          select="substring-after($netstring,'192.168.0.1')"/>
     754        </xsl:call-template>
     755      </xsl:when>
     756      <xsl:when test="contains($netstring,'192.168.0.1') and
     757                      not(contains($netstring,'Gateway'))">
     758        <xsl:call-template name="outputsysdnet">
     759          <xsl:with-param name="netstring"
     760                          select="substring-before($netstring,'192.168.0.1')"/>
     761        </xsl:call-template>
     762        <xsl:value-of select="$nameserver1"/>
     763        <xsl:text>
     764DNS=</xsl:text>
     765        <xsl:value-of select="$nameserver2"/>
     766        <xsl:call-template name="outputsysdnet">
     767          <xsl:with-param name="netstring"
     768                          select="substring-after($netstring,'192.168.0.1')"/>
     769        </xsl:call-template>
     770      </xsl:when>
     771      <xsl:when test="contains($netstring,'192.168.0.2')">
     772        <xsl:call-template name="outputsysdnet">
     773          <xsl:with-param name="netstring"
     774                          select="substring-before($netstring,'192.168.0.2')"/>
     775        </xsl:call-template>
     776        <xsl:value-of select="$ip"/>
     777        <xsl:call-template name="outputsysdnet">
     778          <xsl:with-param name="netstring"
     779                          select="substring-after($netstring,'192.168.0.2')"/>
     780        </xsl:call-template>
     781      </xsl:when>
     782      <xsl:when test="contains($netstring,'24')">
     783        <xsl:call-template name="outputsysdnet">
     784          <xsl:with-param name="netstring"
     785                          select="substring-before($netstring,'24')"/>
     786        </xsl:call-template>
     787        <xsl:value-of select="$prefix"/>
     788        <xsl:call-template name="outputsysdnet">
     789          <xsl:with-param name="netstring"
     790                          select="substring-after($netstring,'24')"/>
     791        </xsl:call-template>
     792      </xsl:when>
     793      <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
     794        <xsl:call-template name="outputsysdnet">
     795          <xsl:with-param name="netstring"
     796                          select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
     797        </xsl:call-template>
     798        <xsl:value-of select="$domain"/>
     799        <xsl:call-template name="outputsysdnet">
     800          <xsl:with-param name="netstring"
     801                          select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
    709802        </xsl:call-template>
    710803      </xsl:when>
Note: See TracChangeset for help on using the changeset viewer.