[Libosinfo] [osinfo-db PATCH 11/16] install-script, rhel: Improve script-disk template

Fabiano Fidêncio fidencio at redhat.com
Tue Jun 18 19:06:27 UTC 2019


Let's improve the script disk template so we don't actually require the
apps to set it (but, if they do, the value set will be used).

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 .../redhat.com/rhel-kickstart-desktop.xml.in       | 14 ++++++++++++--
 .../redhat.com/rhel-kickstart-jeos.xml.in          | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/data/install-script/redhat.com/rhel-kickstart-desktop.xml.in b/data/install-script/redhat.com/rhel-kickstart-desktop.xml.in
index aec7cf7..d4993e8 100644
--- a/data/install-script/redhat.com/rhel-kickstart-desktop.xml.in
+++ b/data/install-script/redhat.com/rhel-kickstart-desktop.xml.in
@@ -15,7 +15,7 @@
         <param name="avatar-location" policy="optional"/>
         <param name="avatar-disk" policy="optional"/>
         <param name="target-disk" policy="optional"/>
-        <param name="script-disk" policy="required"/>
+        <param name="script-disk" policy="optional"/>
     </config>
     <injection-method>cdrom</injection-method>
     <injection-method>disk</injection-method>
@@ -49,7 +49,17 @@
 
         <xsl:template name="script-disk">
           <xsl:variable name="script-disk">
-            <xsl:value-of select="config/script-disk"/>
+            <xsl:choose>
+              <xsl:when test="config/script-disk != ''">
+                <xsl:value-of select="config/script-disk"/>
+              </xsl:when>
+              <xsl:when test="os/version > 5.5">
+                <xsl:text>/dev/sda</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>/dev/sdb</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:variable>
           <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
         </xsl:template>
diff --git a/data/install-script/redhat.com/rhel-kickstart-jeos.xml.in b/data/install-script/redhat.com/rhel-kickstart-jeos.xml.in
index c15e926..790794c 100644
--- a/data/install-script/redhat.com/rhel-kickstart-jeos.xml.in
+++ b/data/install-script/redhat.com/rhel-kickstart-jeos.xml.in
@@ -10,7 +10,7 @@
       <param name="l10n-language" policy="optional"/>
       <param name="l10n-timezone" policy="optional"/>
       <param name="target-disk" policy="optional"/>
-      <param name="script-disk" policy="required"/>
+      <param name="script-disk" policy="optional"/>
     </config>
     <injection-method>cdrom</injection-method>
     <injection-method>disk</injection-method>
@@ -41,7 +41,17 @@
 
         <xsl:template name="script-disk">
           <xsl:variable name="script-disk">
-            <xsl:value-of select="config/script-disk"/>
+            <xsl:choose>
+              <xsl:when test="config/script-disk != ''">
+                <xsl:value-of select="config/script-disk"/>
+              </xsl:when>
+              <xsl:when test="os/version > 5.5">
+                <xsl:text>/dev/sda</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>/dev/sdb</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:variable>
           <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
         </xsl:template>
-- 
2.21.0




More information about the Libosinfo mailing list