| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE xsl:stylesheet [ |
| 3 |
<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'"> |
| 4 |
<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"> |
| 5 |
]> |
| 6 |
<xsl:stylesheet version="1.0" |
| 7 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 8 |
<xsl:output method="xml" |
| 9 |
indent="yes" omit-xml-declaration="no" encoding="utf-8"/> |
| 10 |
<xsl:strip-space elements="type"/> |
| 11 |
|
| 12 |
<!-- create systemdisk element with optional home volume if oem-home is set --> |
| 13 |
<xsl:template name="add-systemdisk" mode="conv47to48"> |
| 14 |
<xsl:param name="content"/> |
| 15 |
<xsl:param name="lvm"/> |
| 16 |
<xsl:choose> |
| 17 |
<xsl:when test="$content = 'true'"> |
| 18 |
<systemdisk name="kiwiVG"> |
| 19 |
<volume name="/home" freespace="200M"/> |
| 20 |
</systemdisk> |
| 21 |
</xsl:when> |
| 22 |
<xsl:otherwise> |
| 23 |
<xsl:choose> |
| 24 |
<xsl:when test="$lvm = 'true'"> |
| 25 |
<systemdisk name="kiwiVG"/> |
| 26 |
</xsl:when> |
| 27 |
</xsl:choose> |
| 28 |
</xsl:otherwise> |
| 29 |
</xsl:choose> |
| 30 |
</xsl:template> |
| 31 |
|
| 32 |
<!-- default rule conv47to48 --> |
| 33 |
<xsl:template match="*" mode="conv47to48"> |
| 34 |
<xsl:copy> |
| 35 |
<xsl:copy-of select="@*"/> |
| 36 |
<xsl:apply-templates mode="conv47to48"/> |
| 37 |
</xsl:copy> |
| 38 |
</xsl:template> |
| 39 |
|
| 40 |
<!-- version update --> |
| 41 |
<para xmlns="http://docbook.org/ns/docbook"> |
| 42 |
Changed attribute <tag class="attribute">schemaversion</tag> |
| 43 |
to <tag class="attribute">schemaversion</tag> from |
| 44 |
<literal>4.7</literal> to <literal>4.8</literal>. |
| 45 |
</para> |
| 46 |
<xsl:template match="image" mode="conv47to48"> |
| 47 |
<xsl:choose> |
| 48 |
<!-- nothing to do if already at 4.8 --> |
| 49 |
<xsl:when test="@schemaversion > 4.7"> |
| 50 |
<xsl:copy-of select="."/> |
| 51 |
</xsl:when> |
| 52 |
<!-- otherwise apply templates --> |
| 53 |
<xsl:otherwise> |
| 54 |
<image schemaversion="4.8"> |
| 55 |
<xsl:copy-of select="@*[local-name() != 'schemaversion']"/> |
| 56 |
<xsl:apply-templates mode="conv47to48"/> |
| 57 |
</image> |
| 58 |
</xsl:otherwise> |
| 59 |
</xsl:choose> |
| 60 |
</xsl:template> |
| 61 |
|
| 62 |
<!-- toplevel processing instructions and comments --> |
| 63 |
<xsl:template match="processing-instruction()|comment()" mode="conv47to48"> |
| 64 |
<xsl:copy> |
| 65 |
<xsl:copy-of select="@*"/> |
| 66 |
<xsl:apply-templates mode="conv47to48"/> |
| 67 |
</xsl:copy> |
| 68 |
</xsl:template> |
| 69 |
|
| 70 |
<!-- remove lvm attribute, call add-systemdisk if no lvmvolumes exists and |
| 71 |
either lvm is enabled or oem-home exists and set to true in oemconfig |
| 72 |
if lvmvolumes exists and there is oem-home enabled too, add a home |
| 73 |
volume in the existing lvmvolumes section --> |
| 74 |
<xsl:template match="type" mode="conv47to48"> |
| 75 |
<type> |
| 76 |
<xsl:copy-of select="@*[not(local-name(.) = 'lvm')]"/> |
| 77 |
<xsl:choose> |
| 78 |
<xsl:when test="lvmvolumes"> |
| 79 |
<xsl:variable name="content" |
| 80 |
select="translate(normalize-space(oemconfig/oem-home), |
| 81 |
&uppercase;, &lowercase;)" |
| 82 |
/> |
| 83 |
<xsl:choose> |
| 84 |
<xsl:when test="$content = 'true'"> |
| 85 |
<xsl:apply-templates |
| 86 |
select="*[not(self::lvmvolumes)]" mode="conv47to48" |
| 87 |
/> |
| 88 |
<xsl:apply-templates select="lvmvolumes" |
| 89 |
mode="mode-volumes" |
| 90 |
/> |
| 91 |
</xsl:when> |
| 92 |
<xsl:otherwise> |
| 93 |
<xsl:apply-templates mode="conv47to48"/> |
| 94 |
</xsl:otherwise> |
| 95 |
</xsl:choose> |
| 96 |
</xsl:when> |
| 97 |
<xsl:otherwise> |
| 98 |
<xsl:call-template name="add-systemdisk"> |
| 99 |
<xsl:with-param name="lvm" select="@lvm"/> |
| 100 |
<xsl:with-param name="content" select="oemconfig/oem-home"/> |
| 101 |
</xsl:call-template> |
| 102 |
<xsl:apply-templates mode="conv47to48"/> |
| 103 |
</xsl:otherwise> |
| 104 |
</xsl:choose> |
| 105 |
</type> |
| 106 |
</xsl:template> |
| 107 |
|
| 108 |
<!-- add home volume in mode-volumes, see type template --> |
| 109 |
<xsl:template match="lvmvolumes" mode="mode-volumes"> |
| 110 |
<systemdisk> |
| 111 |
<xsl:copy-of select="@*"/> |
| 112 |
<volume name="/home" freespace="200M"/> |
| 113 |
<xsl:apply-templates mode="conv47to48"/> |
| 114 |
</systemdisk> |
| 115 |
</xsl:template> |
| 116 |
|
| 117 |
<!-- turn existing lvmvolumes into systemdisk --> |
| 118 |
<xsl:template match="lvmvolumes" mode="conv47to48"> |
| 119 |
<systemdisk> |
| 120 |
<xsl:copy-of select="@*[not(local-name(.) = 'lvmgroup')]"/> |
| 121 |
<xsl:variable name="groupname" select="@lvmgroup"/> |
| 122 |
<xsl:choose> |
| 123 |
<xsl:when test="@lvmgroup!=''"> |
| 124 |
<xsl:attribute name="name"> |
| 125 |
<xsl:value-of select="$groupname"/> |
| 126 |
</xsl:attribute> |
| 127 |
</xsl:when> |
| 128 |
</xsl:choose> |
| 129 |
<xsl:apply-templates mode="conv47to48"/> |
| 130 |
</systemdisk> |
| 131 |
</xsl:template> |
| 132 |
|
| 133 |
<!-- remove oem-home --> |
| 134 |
<xsl:template match="oemconfig/oem-home" mode="conv47to48"> |
| 135 |
</xsl:template> |
| 136 |
|
| 137 |
</xsl:stylesheet> |