forked from mirrors/linux-bench
Merge pull request #13 from yoavrotems/patch-6
gets also ubuntu version
This commit is contained in:
commit
1e3435556e
1 changed files with 3 additions and 2 deletions
5
utils.go
5
utils.go
|
@ -102,13 +102,14 @@ func GetLSM() (lsm string, err error) {
|
|||
}
|
||||
|
||||
func getPlatformVersion(output, platform string) string {
|
||||
flagRe := regexp.MustCompile("version_id" + `=([^ \n]*)`)
|
||||
flagRe := regexp.MustCompile(`version[_id]*=([^ \n]*)`)
|
||||
vals := flagRe.FindStringSubmatch(output)
|
||||
|
||||
if len(vals) > 1 {
|
||||
switch platform {
|
||||
case "rhel":
|
||||
return vals[1][:1] // Get the major version only, examaple: 7.6 will return 7
|
||||
case "ubuntu":
|
||||
return vals[1][:2] // Get the major version only, examaple: 18.04 will return 18
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue