/
support_linux.go
62 lines (49 loc) · 1.69 KB
/
support_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package support
// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
import (
"github.com/essentialkaos/ek/v12/system"
"github.com/essentialkaos/ek/v12/system/container"
)
// ////////////////////////////////////////////////////////////////////////////////// //
// appendSystemInfo appends system info
func (i *Info) appendSystemInfo() {
systemInfo, err := system.GetSystemInfo()
if err != nil {
return
}
i.System = &SystemInfo{
Name: systemInfo.OS,
Arch: systemInfo.Arch,
Kernel: systemInfo.Kernel,
}
if i.OS != nil {
i.System.Name = i.OS.Name
}
i.System.ContainerEngine = container.GetEngine()
}
// appendOSInfo appends OS info
func (i *Info) appendOSInfo() {
osInfo, err := system.GetOSInfo()
if err != nil {
return
}
i.OS = &OSInfo{
Name: osInfo.Name,
PrettyName: osInfo.PrettyName,
Version: osInfo.Version,
ID: osInfo.ID,
IDLike: osInfo.IDLike,
VersionID: osInfo.VersionID,
VersionCode: osInfo.VersionCodename,
PlatformID: osInfo.PlatformID,
CPE: osInfo.CPEName,
coloredName: osInfo.ColoredName(),
coloredPrettyName: osInfo.ColoredPrettyName(),
}
}
// ////////////////////////////////////////////////////////////////////////////////// //