mirror of
https://github.com/oneclickvirt/basics.git
synced 2025-10-09 02:20:18 +08:00
update
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
@@ -125,6 +126,16 @@ func getHostInfo() (string, string, string, string, string, string, string, stri
|
|||||||
if os.IsExist(err) {
|
if os.IsExist(err) {
|
||||||
VmType = "Docker"
|
VmType = "Docker"
|
||||||
}
|
}
|
||||||
|
cgroupFile, err := os.Open("/proc/1/cgroup")
|
||||||
|
defer cgroupFile.Close()
|
||||||
|
if err == nil {
|
||||||
|
scanner := bufio.NewScanner(cgroupFile)
|
||||||
|
for scanner.Scan() {
|
||||||
|
if strings.Contains(scanner.Text(), "docker") {
|
||||||
|
VmType = "Docker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_, err = os.Stat("/dev/lxss")
|
_, err = os.Stat("/dev/lxss")
|
||||||
if os.IsExist(err) {
|
if os.IsExist(err) {
|
||||||
VmType = "Windows Subsystem for Linux"
|
VmType = "Windows Subsystem for Linux"
|
||||||
|
Reference in New Issue
Block a user