mirror of
https://github.com/containers/podman.git
synced 2025-10-27 11:15:38 +08:00
Merge pull request #11556 from afbjorklund/distribution-info
Show variant and codename of the distribution
This commit is contained in:
@ -78,7 +78,9 @@ type IDMappings struct {
|
||||
// for libpod
|
||||
type DistributionInfo struct {
|
||||
Distribution string `json:"distribution"`
|
||||
Variant string `json:"variant,omitempty"`
|
||||
Version string `json:"version"`
|
||||
Codename string `json:"codename,omitempty"`
|
||||
}
|
||||
|
||||
// ConmonInfo describes the conmon executable being used
|
||||
|
||||
@ -370,9 +370,15 @@ func (r *Runtime) GetHostDistributionInfo() define.DistributionInfo {
|
||||
if strings.HasPrefix(l.Text(), "ID=") {
|
||||
dist.Distribution = strings.TrimPrefix(l.Text(), "ID=")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VARIANT_ID=") {
|
||||
dist.Variant = strings.Trim(strings.TrimPrefix(l.Text(), "VARIANT_ID="), "\"")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VERSION_ID=") {
|
||||
dist.Version = strings.Trim(strings.TrimPrefix(l.Text(), "VERSION_ID="), "\"")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VERSION_CODENAME=") {
|
||||
dist.Codename = strings.Trim(strings.TrimPrefix(l.Text(), "VERSION_CODENAME="), "\"")
|
||||
}
|
||||
}
|
||||
return dist
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user