Skip to content

Commit

Permalink
almalinux version fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Istiak Ferdous authored and zcalusic committed Sep 18, 2024
1 parent db747cd commit 95c15a9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions os.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
reID = regexp.MustCompile(`^ID=(.*)$`)
reVersionID = regexp.MustCompile(`^VERSION_ID=(.*)$`)
reUbuntu = regexp.MustCompile(`[\( ]([\d\.]+)`)
reAlma = regexp.MustCompile(`^AlmaLinux release ([\d\.]+)`)
reCentOS = regexp.MustCompile(`^CentOS( Linux)? release ([\d\.]+)`)
reRocky = regexp.MustCompile(`^Rocky Linux release ([\d\.]+)`)
reRedHat = regexp.MustCompile(`[\( ]([\d\.]+)`)
Expand Down Expand Up @@ -62,6 +63,14 @@ func (si *SysInfo) getOSInfo() {
if m := reUbuntu.FindStringSubmatch(si.OS.Name); m != nil {
si.OS.Release = m[1]
}
case "almalinux":
if release := slurpFile("/etc/almalinux-release"); release != "" {
if m := reAlma.FindStringSubmatch(release); m != nil {
si.OS.Release = m[1]
}
}

si.OS.Version = strings.Split(si.OS.Release, ".")[0]
case "centos":
if release := slurpFile("/etc/centos-release"); release != "" {
if m := reCentOS.FindStringSubmatch(release); m != nil {
Expand Down

0 comments on commit 95c15a9

Please sign in to comment.