[Libosinfo] [libosinfo PATCH 1/3] centos, kickstart: Improve installation URL usage

Fabiano Fidêncio fidencio at redhat.com
Thu Mar 7 10:28:38 UTC 2019


Let's always prefer using the URL passed by some management app, if
there's not, let's fallback to the URL set in the OsinfoTree and,
finally, if there's none, let's fallback to the known one.

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

diff --git a/data/install-script/centos.org/centos-kickstart-desktop.xml.in b/data/install-script/centos.org/centos-kickstart-desktop.xml.in
index a1c3373..18cd2dd 100644
--- a/data/install-script/centos.org/centos-kickstart-desktop.xml.in
+++ b/data/install-script/centos.org/centos-kickstart-desktop.xml.in
@@ -91,6 +91,23 @@
           </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="installation-url">
+          <xsl:choose>
+            <xsl:when test="config/installation-url != ''">
+              <xsl:value-of select="config/installation-url"/>
+            </xsl:when>
+            <xsl:when test="treel/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>http://mirror.centos.org/centos/</xsl:text>
+              <xsl:call-template name="version"/>
+              <xsl:text>/os/</xsl:text>
+              <xsl:call-template name="arch"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template match="/install-script-config">
 # Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
 <xsl:if test="script/installation-source = 'media'">
@@ -126,7 +143,7 @@ logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
 reboot
 
 <xsl:if test="script/installation-source = 'network'">
-url --url="http://mirror.centos.org/centos/<xsl:call-template name="version"/>/os/<xsl:call-template name="arch"/>"
+url --url=<xsl:call-template name="installation-url"/>
 </xsl:if>
 
 %packages
diff --git a/data/install-script/centos.org/centos-kickstart-jeos.xml.in b/data/install-script/centos.org/centos-kickstart-jeos.xml.in
index 0f1efc2..d8290e4 100644
--- a/data/install-script/centos.org/centos-kickstart-jeos.xml.in
+++ b/data/install-script/centos.org/centos-kickstart-jeos.xml.in
@@ -83,6 +83,23 @@
           </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="installation-url">
+          <xsl:choose>
+            <xsl:when test="config/installation-url != ''">
+              <xsl:value-of select="config/installation-url"/>
+            </xsl:when>
+            <xsl:when test="treel/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>http://mirror.centos.org/centos/</xsl:text>
+              <xsl:call-template name="version"/>
+              <xsl:text>/os/</xsl:text>
+              <xsl:call-template name="arch"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template match="/install-script-config">
 # Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
 <xsl:if test="script/installation-source = 'media'">
@@ -120,7 +137,7 @@ logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
 reboot
 
 <xsl:if test="script/installation-source = 'network'">
-url --url="http://mirror.centos.org/centos/<xsl:call-template name="version"/>/os/<xsl:call-template name="arch"/>"
+url --url=<xsl:call-template name="installation-url"/>
 </xsl:if>
 
 %packages
-- 
2.20.1




More information about the Libosinfo mailing list