Fix the generation of scripts of

the networkd page (systemd book).
This commit is contained in:
Pierre Labastie 2017-03-05 08:49:45 +00:00
parent deb6b6c8fd
commit d8ddcfb96a

View file

@ -635,6 +635,11 @@ unset OLD_PKGDIR
<xsl:with-param name="netstring" select="string()"/> <xsl:with-param name="netstring" select="string()"/>
</xsl:call-template> </xsl:call-template>
</xsl:when> </xsl:when>
<xsl:when test="contains(string(),'[Match]')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring" select="string()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:otherwise> </xsl:otherwise>
@ -714,6 +719,94 @@ unset OLD_PKGDIR
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template name="outputsysdnet">
<xsl:param name="netstring" select="''"/>
<!-- We suppose that book example has the following values:
- interface: eth0
- ip: 192.168.0.2
- gateway: 192.168.0.1
- prefix: 24
- DNS: 192.168.0.1
- Domain: <Your Domain Name>
and gateway comes before DNS. Change below if book changes -->
<xsl:choose>
<xsl:when test="contains($netstring,'eth0')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'eth0')"/>
</xsl:call-template>
<xsl:value-of select="$interface"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'eth0')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($netstring,'192.168.0.1') and
contains($netstring,'Gateway')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'192.168.0.1')"/>
</xsl:call-template>
<xsl:value-of select="$gateway"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'192.168.0.1')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($netstring,'192.168.0.1') and
not(contains($netstring,'Gateway'))">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'192.168.0.1')"/>
</xsl:call-template>
<xsl:value-of select="$nameserver1"/>
<xsl:text>
DNS=</xsl:text>
<xsl:value-of select="$nameserver2"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'192.168.0.1')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($netstring,'192.168.0.2')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'192.168.0.2')"/>
</xsl:call-template>
<xsl:value-of select="$ip"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'192.168.0.2')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($netstring,'24')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'24')"/>
</xsl:call-template>
<xsl:value-of select="$prefix"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'24')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
</xsl:call-template>
<xsl:value-of select="$domain"/>
<xsl:call-template name="outputsysdnet">
<xsl:with-param name="netstring"
select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$netstring"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="outputpkgdest"> <xsl:template name="outputpkgdest">
<xsl:param name="outputstring" select="foo"/> <xsl:param name="outputstring" select="foo"/>
<xsl:choose> <xsl:choose>