add support for some special cases

This commit is contained in:
Muhammed Efe Cetin
2024-01-31 22:25:10 +03:00
committed by Igor
parent c8c81b3e34
commit 96aedbae7f

13
map.go
View File

@@ -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
}