From 1b3ca03504c78f71b127488eca51fc152cd4f366 Mon Sep 17 00:00:00 2001 From: Thomas Winkler <2049715+tew42@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:55:13 +0200 Subject: [PATCH] Update openwrt-http.go for handling new 23.x release The initial update neglected to consider that the directory structure of 23.x matches that of snapshot for ARM now. Since future builds will retain this, made it the default. Also some code cleanup for x86_64 Signed-off-by: Thomas Winkler <2049715+tew42@users.noreply.github.com> --- sources/openwrt-http.go | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sources/openwrt-http.go b/sources/openwrt-http.go index c225986e..73232b6b 100644 --- a/sources/openwrt-http.go +++ b/sources/openwrt-http.go @@ -31,17 +31,17 @@ func (s *openwrt) Run() error { case "x86_64": architecturePath = strings.Replace(s.definition.Image.ArchitectureMapped, "_", "/", 1) case "armv7l": - if release == "snapshot" { - architecturePath = "armsr/armv7" - } else { + if strings.HasPrefix(release, "21.02") || strings.HasPrefix(release, "22.03") { architecturePath = "armvirt/32" + } else { + architecturePath = "armsr/armv7" } case "aarch64": - if release == "snapshot" { - architecturePath = "armsr/armv8" - } else { + if strings.HasPrefix(release, "21.02") || strings.HasPrefix(release, "22.03") { architecturePath = "armvirt/64" + } else { + architecturePath = "armsr/armv8" } } @@ -78,25 +78,18 @@ func (s *openwrt) Run() error { if release == "snapshot" { switch s.definition.Image.ArchitectureMapped { case "x86_64": - fname = fmt.Sprintf("openwrt-%s%s-rootfs.tar.gz", releaseInFilename, - strings.Replace(architecturePath, "/", "-", 1)) + fallthrough case "armv7l": fallthrough case "aarch64": - fname = fmt.Sprintf("openwrt-%s-rootfs.tar.gz", + fname = fmt.Sprintf("openwrt-%s%s-rootfs.tar.gz", releaseInFilename, strings.Replace(architecturePath, "/", "-", 1)) } } else { switch s.definition.Image.ArchitectureMapped { case "x86_64": - if strings.HasPrefix(release, "21.02") || strings.HasPrefix(release, "22.03") || strings.HasPrefix(release, "23.05") { - fname = fmt.Sprintf("openwrt-%s%s-rootfs.tar.gz", releaseInFilename, - strings.Replace(architecturePath, "/", "-", 1)) - } else { - fname = fmt.Sprintf("openwrt-%s%s-generic-rootfs.tar.gz", releaseInFilename, - strings.Replace(architecturePath, "/", "-", 1)) - } - + fname = fmt.Sprintf("openwrt-%s%s-rootfs.tar.gz", releaseInFilename, + strings.Replace(architecturePath, "/", "-", 1)) case "armv7l": fallthrough case "aarch64":