I’m trying to process my autoyast partitions section on the fly using pre-scripts - something I’ve done on a small scale before, but I’m stuck on this one.
I want to conditionally not format the filesystem named <root>, so
I want to change the <format> bool to false, but only in the partition labelled <root>
My xsl already matches and changes the <initialize> bool to false, but I’m stuck on the xsl code to change the single partition element;
The partition section of my autoyast is:
<?xml version="1.0"?><!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<partitioning config:type="list">
<drive>
<initialize config:type="boolean">true</initialize>
<partitions config:type="list">
<partition>
<create config:type="boolean">true</create>
<filesystem config:type="symbol">ext4</filesystem>
<format config:type="boolean">true</format>
<fstopt>acl,user_xattr</fstopt>
<label>root</label>
<mount>/</mount>
<mountby config:type="symbol">label</mountby>
<partition_id config:type="integer">131</partition_id>
<size>50G</size>
</partition>
<partition>
<create config:type="boolean">true</create>
<filesystem config:type="symbol">swap</filesystem>
<format config:type="boolean">true</format>
<fstopt>defaults</fstopt>
<label>swap</label>
<mount>swap</mount>
<mountby config:type="symbol">label</mountby>
<partition_id config:type="integer">130</partition_id>
<size>auto</size>
</partition>
<partition>
<create config:type="boolean">true</create>
<filesystem config:type="symbol">ext4</filesystem>
<format config:type="boolean">true</format>
<fstopt>acl,user_xattr</fstopt>
<label>home</label>
<mount>/home</mount>
<mountby config:type="symbol">label</mountby>
<partition_id config:type="integer">131</partition_id>
<size>10G</size>
</partition>
<partition>
<create config:type="boolean">true</create>
<filesystem config:type="symbol">ext4</filesystem>
<format config:type="boolean">true</format>
<fstopt>acl,user_xattr</fstopt>
<label>u</label>
<mount>/u</mount>
<mountby config:type="symbol">label</mountby>
<partition_id config:type="integer">131</partition_id>
<size>max</size>
</partition>
</partitions>
<pesize/>
<type config:type="symbol">CT_DISK</type>
<use>all</use>
</drive>
</partitioning>
</profile>
and I’m trying to xsltproc it using this xls:
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:y2="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns"
xmlns="http://www.suse.com/1.0/yast2ns"
version="1.0"
exclude-result-prefixes="y2">
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no" cdata-section-elements="source"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="y2:initialize">
<initialize config:type="boolean">false</initialize>
</xsl:template>
</xsl:stylesheet>
Any xsl experts who can help me please!