[Libosinfo] [osinfo-db PATCH 08/16] install-script, opensuse: Add target-disk template

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


Let's add a target-disk template so we actually can use what apps set as
target-disk, instead of using a hardcoded path to /dev/vda.

With this change we keep not requiring the apps to set this value.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 .../opensuse-autoyast-desktop.xml.in          | 21 ++++++++++++++++---
 .../opensuse-autoyast-jeos.xml.in             | 21 ++++++++++++++++---
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in b/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in
index 88c6f51..dfbe176 100644
--- a/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in
+++ b/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in
@@ -7,6 +7,9 @@
     <profile>desktop</profile>
     <expected-filename>autoinst.xml</expected-filename>
     <config>
+      <!-- System options -->
+      <param name="target-disk" policy="optional"/>
+
       <!-- Localization options -->
       <param name="l10n-keyboard" policy="optional" value-map="http://x.org/x11-keyboard"/>
       <param name="l10n-language" policy="optional"/>
@@ -34,6 +37,18 @@
 
         <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
 
+        <xsl:template name="target-disk">
+          <xsl:choose>
+            <xsl:when test="config/target-disk != ''">
+              <xsl:value-of select="config/target-disk"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <!-- virtio -->
+              <xsl:text>/dev/vda</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template name="l10n-language">
           <xsl:choose>
             <xsl:when test="config/l10n-language != '' and config/l10n-language != 'C'">
@@ -140,12 +155,12 @@
               <device_map config:type="list">
                 <device_map_entry>
                   <firmware>hd0</firmware>
-                  <linux>/dev/vda</linux>
+                  <linux><xsl:call-template name="target-disk"/></linux>
                 </device_map_entry>
               </device_map>
               <global>
                 <activate>true</activate>
-                <append>resume=/dev/vda1 splash=silent quiet showopts</append>
+                <append>resume=<xsl:call-template name="target-disk"/>1 splash=silent quiet showopts</append>
                 <boot_boot>false</boot_boot>
                 <boot_extended>false</boot_extended>
                 <boot_mbr>false</boot_mbr>
@@ -210,7 +225,7 @@
           </networking>
           <partitioning config:type="list">
             <drive>
-              <device>/dev/vda</device>
+              <device><xsl:call-template name="target-disk"/></device>
               <type config:type="symbol">CT_DISK</type>
               <use>all</use>
             </drive>
diff --git a/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in b/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in
index 4ae1280..9f7af9f 100644
--- a/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in
+++ b/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in
@@ -7,6 +7,9 @@
     <profile>jeos</profile>
     <expected-filename>autoinst.xml</expected-filename>
     <config>
+      <!-- System options -->
+      <param name="target-disk" policy="optional"/>
+
       <!-- Localization options -->
       <param name="l10n-keyboard" policy="optional" value-map="http://x.org/x11-keyboard"/>
       <param name="l10n-language" policy="optional"/>
@@ -25,6 +28,18 @@
 
         <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
 
+        <xsl:template name="target-disk">
+          <xsl:choose>
+            <xsl:when test="config/target-disk != ''">
+              <xsl:value-of select="config/target-disk"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <!-- virtio -->
+              <xsl:text>/dev/vda</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template name="l10n-language">
           <xsl:choose>
             <xsl:when test="config/l10n-language != '' and config/l10n-language != 'C'">
@@ -131,12 +146,12 @@
               <device_map config:type="list">
                 <device_map_entry>
                   <firmware>hd0</firmware>
-                  <linux>/dev/vda</linux>
+                  <linux><xsl:call-template name="target-disk"/></linux>
                 </device_map_entry>
               </device_map>
               <global>
                 <activate>true</activate>
-                <append>resume=/dev/vda1 splash=silent quiet showopts</append>
+                <append>resume=<xsl:call-template name="target-disk"/>1 splash=silent quiet showopts</append>
                 <boot_boot>false</boot_boot>
                 <boot_extended>false</boot_extended>
                 <boot_mbr>false</boot_mbr>
@@ -199,7 +214,7 @@
           </networking>
           <partitioning config:type="list">
             <drive>
-              <device>/dev/vda</device>
+              <device><xsl:call-template name="target-disk"/></device>
               <type config:type="symbol">CT_DISK</type>
               <use>all</use>
             </drive>
-- 
2.21.0




More information about the Libosinfo mailing list