|
func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult { |
|
result := &CheckResult{ |
|
Name: CheckNameOSVer, |
|
Msg: fmt.Sprintf("OS is %s %s", osInfo.Name, osInfo.Release), |
|
} |
|
|
|
// check OS vendor |
|
switch osInfo.Vendor { |
|
case "kylin": |
|
// VERSION_ID="V10" |
|
if ver, _ := strconv.ParseFloat(strings.Trim(osInfo.Version, "V"), 64); ver < 10 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version V10 or higher", |
|
osInfo.Name, osInfo.Release) |
|
return result |
|
} |
|
case "amzn": |
|
// https://aws.amazon.com/linux/amazon-linux-2023/ |
|
if osInfo.Version == "2023" { |
|
return result |
|
} |
|
|
|
// Amazon Linux 2 is based on CentOS 7 and is recommended for |
|
// AWS Graviton 2 (ARM64) deployments. |
|
// https://aws.amazon.com/amazon-linux-2/ |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 2 || ver >= 3 { |
|
result.Err = fmt.Errorf("%s %s not supported, use Amazon Linux 2 or Amazon Linux 2023 please", |
|
osInfo.Name, osInfo.Release) |
|
return result |
|
} |
|
case "centos": |
|
// CentOS Linux is EOL |
|
// CentOS Stream 9 and newer is still fine |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 9 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version 9 or higher", |
|
osInfo.Name, osInfo.Release) |
|
return result |
|
} |
|
case "redhat", "rhel", "ol": |
|
// RHEL 8.4 or newer 8.x versions are supported |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 8.4 || ver >= 9 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version 8.4 or a later 8.x version please", |
|
osInfo.Name, osInfo.Release) |
|
return result |
|
} |
|
case "rocky": |
|
// Rocky Linux |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 9.1 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version 9.1 or later please", |
|
osInfo.Name, osInfo.Release) |
|
return result |
|
} |
|
case "debian": |
|
// debian support is not fully tested, but we suppose it should work |
|
msg := "Debian support is not fully tested, be careful" |
|
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg) |
|
result.Warn = true |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 10 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version 10 or higher (%s)", |
|
osInfo.Name, osInfo.Release, msg) |
|
result.Warn = false |
|
return result |
|
} |
|
case "ubuntu": |
|
// ubuntu support is not fully tested, but we suppose it should work |
|
msg := "Ubuntu support is not fully tested, be careful" |
|
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg) |
|
result.Warn = true |
|
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 20.04 { |
|
result.Err = fmt.Errorf("%s %s not supported, use version 20.04 or higher (%s)", |
|
osInfo.Name, osInfo.Release, msg) |
|
result.Warn = false |
|
return result |
|
} |
|
case "openEuler": |
|
return result |
|
default: |
|
result.Err = fmt.Errorf("OS vendor %s not supported", osInfo.Vendor) |
|
return result |
|
} |
|
|
|
// TODO: check OS architecture |
|
|
|
return result |
|
} |
tiup/pkg/cluster/operation/check.go
Lines 167 to 250 in e525ada
This function treats OS versions as float. However, version 8.10 is larger than version 8.4, while float 8.10 is not.
tiup --version)?latest