From f2e755b77b78476a958b8d068963e527dd70fcfa Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Tue, 25 Jul 2023 22:02:18 +0100 Subject: [PATCH] build: allow a larger set of distribution. See #180 --- pkg/prebuild/tools.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkg/prebuild/tools.go b/pkg/prebuild/tools.go index cd66572f0..9b7c68740 100644 --- a/pkg/prebuild/tools.go +++ b/pkg/prebuild/tools.go @@ -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 }