syft/imgbom/distro/type.go
Alfredo Deza 56c2318ea1 add support for distro detection
Signed-off-by: Alfredo Deza <adeza@anchore.com>
2020-06-12 10:49:14 -04:00

72 lines
1.0 KiB
Go

package distro
const (
UnknownDistro Type = iota
Debian
Ubuntu
RedHat
CentOS
// Fedora
// Alpine
Busybox
// AmazonLinux
// OracleLinux
// ArchLinux
)
const (
// UnknownVersion is a default of 0.0.0 when it can't be parsed
UnknownVersion string = "0.0.0"
)
type Type int
var distroStr = []string{
"UnknownDistro",
"debian",
"ubuntu",
"redhat",
"centos",
// "fedora",
// "alpine",
"busybox",
// "amazn",
// "oraclelinux",
// "archlinux",
}
var All = []Type{
Debian,
Ubuntu,
RedHat,
CentOS,
// Fedora,
// Alpine,
Busybox,
// AmazonLinux,
// OracleLinux,
// ArchLinux,
}
func (t Type) String() string {
if int(t) >= len(distroStr) || t < 0 {
return distroStr[0]
}
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,
}