[Libosinfo] [osinfo-db PATCH 4/8] fedora: Prefer user set URL over the default one

Fabiano Fidêncio fidencio at redhat.com
Thu Apr 25 13:27:56 UTC 2019


Similarly to what already has been done for CentOS and RHEL, let's
prefer a user set URL (or the URL set for the tree) whenever those are
available.

https://gitlab.com/libosinfo/osinfo-db/issues/26

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

diff --git a/data/install-script/fedoraproject.org/fedora-kickstart-desktop.xml.in b/data/install-script/fedoraproject.org/fedora-kickstart-desktop.xml.in
index dcdb93f..f918938 100644
--- a/data/install-script/fedoraproject.org/fedora-kickstart-desktop.xml.in
+++ b/data/install-script/fedoraproject.org/fedora-kickstart-desktop.xml.in
@@ -110,6 +110,30 @@
           <xsl:value-of select="script/expected-filename"/>
         </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="tree/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:template>
+
+        <xsl:template name="url-or-mirrorlist">
+          <xsl:choose>
+            <xsl:when test="config/installation-url != '' or tree/url != ''">
+              <xsl:text> --url</xsl:text>
+              <xsl:call-template name="installation-url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text> --mirrorlist=</xsl:text>
+              <xsl:text>https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch</xsl:text>
+            </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' and (count(media/variant) = 0 or not(contains(media/variant, 'netinst')))">
@@ -143,7 +167,7 @@ reboot
 <xsl:if test="script/installation-source = 'network' or contains(media/variant, 'netinst')">
 repo --name=fedora --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
 repo --name=updates --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
-url --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
+url <xsl:call-template name="url-or-mirrorlist"/>
 </xsl:if>
 
 %packages
diff --git a/data/install-script/fedoraproject.org/fedora-kickstart-jeos.xml.in b/data/install-script/fedoraproject.org/fedora-kickstart-jeos.xml.in
index 07fc932..5b5fe8e 100644
--- a/data/install-script/fedoraproject.org/fedora-kickstart-jeos.xml.in
+++ b/data/install-script/fedoraproject.org/fedora-kickstart-jeos.xml.in
@@ -102,6 +102,30 @@
           <xsl:value-of select="script/expected-filename"/>
         </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="tree/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:template>
+
+        <xsl:template name="url-or-mirrorlist">
+          <xsl:choose>
+            <xsl:when test="config/installation-url != '' or tree/url != ''">
+              <xsl:text> --url</xsl:text>
+              <xsl:call-template name="installation-url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text> --mirrorlist=</xsl:text>
+              <xsl:text>https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch</xsl:text>
+            </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' and (count(media/variant) = 0 or not(contains(media/variant, 'netinst')))">
@@ -153,7 +177,7 @@ reboot
 <xsl:if test="script/installation-source='network' or contains(media/variant, 'netinst')">
 repo --name=fedora --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
 repo --name=updates --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
-url --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
+url <xsl:call-template name="url-or-mirrorlist"/>
 </xsl:if>
 
 %packages
-- 
2.21.0




More information about the Libosinfo mailing list