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

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


Similary toi what already has been done for CentOS, RHEL, and Fedora,
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>
---
 .../opensuse-autoyast-desktop.xml.in             | 16 +++++++++++++++-
 .../opensuse.org/opensuse-autoyast-jeos.xml.in   | 16 +++++++++++++++-
 2 files changed, 30 insertions(+), 2 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 7913850..5c30292 100644
--- a/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in
+++ b/data/install-script/opensuse.org/opensuse-autoyast-desktop.xml.in
@@ -67,6 +67,20 @@
           </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="tree/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="repo-oss"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template name="repo-oss">
           <xsl:text> </xsl:text>
           <xsl:text>http://download.opensuse.org/</xsl:text>
@@ -250,7 +264,7 @@ Icon=/var/lib/AccountsService/icons/<xsl:value-of select="config/user-login"/>
 fi
 
 # Enable default OpenSUSE repos
-zypper ar -f <xsl:call-template name="repo-oss"/> repo-oss
+zypper ar -f <xsl:call-template name="installation-url"/> repo-oss
 zypper ar -f <xsl:call-template name="repo-non-oss"/> repo-non-oss
 zypper ar -f <xsl:call-template name="repo-update-oss"/> repo-update-oss
 <xsl:if test="not(contains(os/version, 'tumbleweed'))">
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 23f59dd..8b64d96 100644
--- a/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in
+++ b/data/install-script/opensuse.org/opensuse-autoyast-jeos.xml.in
@@ -58,6 +58,20 @@
           </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="tree/url != ''">
+              <xsl:value-of select="tree/url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="repo-oss"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template name="repo-oss">
           <xsl:text> </xsl:text>
           <xsl:text>http://download.opensuse.org/</xsl:text>
@@ -215,7 +229,7 @@
                   <chrooted config:type="boolean">true</chrooted>
                   <source>
 # Enable default OpenSUSE repos
-zypper ar -f <xsl:call-template name="repo-oss"/> repo-oss
+zypper ar -f <xsl:call-template name="installation-url"/> repo-oss
 zypper ar -f <xsl:call-template name="repo-non-oss"/> repo-non-oss
 zypper ar -f <xsl:call-template name="repo-update-oss"/> repo-update-oss
 <xsl:if test="not(contains(os/version, 'tumbleweed'))">
-- 
2.21.0




More information about the Libosinfo mailing list