[ Agent ] [ Base ] - refresh for euler

This commit is contained in:
zeaslity
2024-01-24 17:09:48 +08:00
parent 2c1cde980c
commit 4ffd48500c
10 changed files with 111 additions and 104 deletions

View File

@@ -17,6 +17,7 @@ func BuildAgentOsOperator(agentInfo *status.AgentInfo, ossOfflinePrefix string)
CanAccessInternet: true,
IsOsTypeUbuntu: true,
IsOsTypeCentOS: false,
IsOsTypeEuler: false,
IsAgentInnerWall: false,
AgentArch: "amd64",
AgentOSReleaseCode: "focal",
@@ -42,21 +43,25 @@ func detectByAgentStatusInfo(agentInfo *status.AgentInfo, os *AgentOsOperator) {
bytes, _ := json.Marshal(agentInfo)
log.DebugF("[detectByAgentStatusInfo] - agent info is => %s", string(bytes))
if strings.Contains(agentInfo.HostInfo.Platform, "openeuler") || strings.Contains(agentInfo.HostInfo.PlatformFamily, "platformFamily") {
if strings.Contains(agentInfo.HostInfo.Platform, "openeuler") || strings.Contains(agentInfo.HostInfo.PlatformFamily, "rehl") {
// centos
os.IsOsTypeUbuntu = false
os.IsOsTypeCentOS = true
if strings.Contains(agentInfo.HostInfo.Platform, "openeuler") {
os.IsOsTypeEuler = true
}
os.InstallCommandPrefix = []string{
"yum", "install", "-y",
}
os.RemoveCommandPrefix = []string{
"yum", "remove",
"yum", "remove", "-y",
}
} else if strings.Contains(agentInfo.HostInfo.PlatformFamily, "debian") {
// ubuntu
os.IsOsTypeUbuntu = true
os.IsOsTypeCentOS = false
os.IsOsTypeEuler = false
os.RemoveCommandPrefix = []string{"apt", "remove", "-y"}
os.InstallCommandPrefix = []string{
"apt-get", "install", "--allow-downgrades", "-y",