Skip to content

Commit

Permalink
Show variant and codename of the distribution
Browse files Browse the repository at this point in the history
Along with the name (id) and the version(_id)

But only show the information if is available

Examples: Fedora CoreOS, Ubuntu Focal

[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Sep 14, 2021
1 parent 20daae1 commit 38c5f67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/markdown/podman-info.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ host:
cpus: 8
distribution:
distribution: fedora
variant: workstation
version: "34"
eventLogger: journald
hostname: localhost.localdomain
Expand Down
2 changes: 2 additions & 0 deletions libpod/define/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions libpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 38c5f67

Please sign in to comment.