From a30d392168a01c358c76b267967d233d43538640 Mon Sep 17 00:00:00 2001 From: Muhammed Efe Cetin Date: Wed, 31 Jan 2024 22:25:10 +0300 Subject: [PATCH] add support for some special cases --- map.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/map.go b/map.go index dc9a25b..6a7f313 100644 --- a/map.go +++ b/map.go @@ -4,13 +4,14 @@ import ( "encoding/csv" "encoding/json" "errors" - log "github.com/sirupsen/logrus" "io" "net/url" "os" "path" "strings" + log "github.com/sirupsen/logrus" + "golang.org/x/text/cases" "golang.org/x/text/language" ) @@ -130,6 +131,16 @@ func loadMapJSON(f io.Reader) (map[string]string, error) { sb.WriteString(file.Preinstalled) } + // Check special case for some extensions + switch { + case strings.HasSuffix(file.Extension, "boot-boe.img.xz"): + sb.WriteString("-boot-boe") + case strings.HasSuffix(file.Extension, "boot-csot.img.xz"): + sb.WriteString("-boot-csot") + case strings.HasSuffix(file.Extension, "rootfs.img.xz"): + sb.WriteString("-rootfs") + } + if strings.HasSuffix(file.Extension, "img.xz") { m[sb.String()] = u.Path }