build: allow a larger set of distribution.

See #180
This commit is contained in:
Alexandre Pujol 2023-07-25 22:02:18 +01:00
parent 6ea2df19eb
commit f2e755b77b
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC

View File

@ -15,6 +15,13 @@ import (
var (
osReleaseFile = "/etc/os-release"
firstPartyDists = []string{"arch", "debian", "ubuntu", "opensuse", "whonix"}
supportedDists = map[string][]string{
"arch": {},
"debian": {},
"ubuntu": {},
"opensuse": {"suse"},
"whonix": {},
}
)
func getSupportedDistribution() string {
@ -39,10 +46,14 @@ func getSupportedDistribution() string {
}
}
if slices.Contains(firstPartyDists, id) {
return id
} else if slices.Contains(firstPartyDists, id_like) {
return id_like
for main, based := range supportedDists {
if main == id || main == id_like {
return main
} else if slices.Contains(based, id) {
return main
} else if slices.Contains(based, id_like) {
return main
}
}
return id
}