mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
add support for distro detection
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
f1851556a8
commit
56c2318ea1
@ -3,41 +3,46 @@ package distro
|
|||||||
const (
|
const (
|
||||||
UnknownDistro Type = iota
|
UnknownDistro Type = iota
|
||||||
Debian
|
Debian
|
||||||
// Ubuntu
|
Ubuntu
|
||||||
// RedHat
|
RedHat
|
||||||
// CentOS
|
CentOS
|
||||||
// Fedora
|
// Fedora
|
||||||
// Alpine
|
// Alpine
|
||||||
// Busybox
|
Busybox
|
||||||
// AmazonLinux
|
// AmazonLinux
|
||||||
// OracleLinux
|
// OracleLinux
|
||||||
// ArchLinux
|
// ArchLinux
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// UnknownVersion is a default of 0.0.0 when it can't be parsed
|
||||||
|
UnknownVersion string = "0.0.0"
|
||||||
|
)
|
||||||
|
|
||||||
type Type int
|
type Type int
|
||||||
|
|
||||||
var distroStr = []string{
|
var distroStr = []string{
|
||||||
"UnknownDistro",
|
"UnknownDistro",
|
||||||
"Debian",
|
"debian",
|
||||||
// "Ubuntu",
|
"ubuntu",
|
||||||
// "RedHat",
|
"redhat",
|
||||||
// "CentOS",
|
"centos",
|
||||||
// "Fedora",
|
// "fedora",
|
||||||
// "Alpine",
|
// "alpine",
|
||||||
// "Busybox",
|
"busybox",
|
||||||
// "AmazonLinux",
|
// "amazn",
|
||||||
// "OracleLinux",
|
// "oraclelinux",
|
||||||
// "ArchLinux",
|
// "archlinux",
|
||||||
}
|
}
|
||||||
|
|
||||||
var All = []Type{
|
var All = []Type{
|
||||||
Debian,
|
Debian,
|
||||||
// Ubuntu,
|
Ubuntu,
|
||||||
// RedHat,
|
RedHat,
|
||||||
// CentOS,
|
CentOS,
|
||||||
// Fedora,
|
// Fedora,
|
||||||
// Alpine,
|
// Alpine,
|
||||||
// Busybox,
|
Busybox,
|
||||||
// AmazonLinux,
|
// AmazonLinux,
|
||||||
// OracleLinux,
|
// OracleLinux,
|
||||||
// ArchLinux,
|
// ArchLinux,
|
||||||
@ -50,3 +55,17 @@ func (t Type) String() string {
|
|||||||
|
|
||||||
return distroStr[t]
|
return distroStr[t]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mappings connects a distro ID like "ubuntu" to a Distro type
|
||||||
|
var Mappings = map[string]Type{
|
||||||
|
"debian": Debian,
|
||||||
|
"ubuntu": Ubuntu,
|
||||||
|
"rhel": RedHat,
|
||||||
|
"centos": CentOS,
|
||||||
|
// "fedora": Fedora,
|
||||||
|
// "alpine": Alpine,
|
||||||
|
"busybox": Busybox,
|
||||||
|
// "amazn": AmazonLinux,
|
||||||
|
// "oraclelinux": OracleLinux,
|
||||||
|
// "archlinux": ArchLinux,
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user