The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/381

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===

From 4eed9c1197d39fb2f054c18425dfd41599c34d53 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Tue, 8 Dec 2020 17:46:40 +0100
Subject: [PATCH] sources/openwrt: Use fallback image if necessary

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 sources/openwrt-http.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sources/openwrt-http.go b/sources/openwrt-http.go
index 4093f50..d40de2e 100644
--- a/sources/openwrt-http.go
+++ b/sources/openwrt-http.go
@@ -68,6 +68,18 @@ func (s *OpenWrtHTTP) Run(definition shared.Definition, 
rootfsDir string) error
                        strings.Replace(definition.Image.ArchitectureMapped, 
"_", "-", 1))
        }
 
+       resp, err := http.Head(baseURL)
+       if err != nil {
+               return err
+       }
+
+       // Use fallback image "generic"
+       if resp.StatusCode == http.StatusNotFound && 
definition.Image.ArchitectureMapped == "x86_64" {
+               baseURL = strings.ReplaceAll(baseURL, "x86/64", "x86/generic")
+               baseURL = strings.ReplaceAll(baseURL, "x86-64", "x86-generic")
+               fname = strings.ReplaceAll(fname, "x86-64", "x86-generic")
+       }
+
        url, err := url.Parse(baseURL)
        if err != nil {
                return err
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to