Commit c3f9482d authored by szh's avatar szh

up

parent fdc48594
...@@ -57,3 +57,29 @@ func GetLocalUUID() string { ...@@ -57,3 +57,29 @@ func GetLocalUUID() string {
return "" return ""
} }
func GetLocalUUID2() string {
cmd := exec.Command("dmidecode","-s","system-uuid")
var buf, errbuf bytes.Buffer
cmd.Stdout = &buf
cmd.Stderr = &errbuf
err := cmd.Start()
if err != nil {
cmdLog.Error("GetLocalUUID Start","err", err)
}
err = cmd.Wait()
if err != nil {
cmdLog.Error("GetLocalUUID Wait", err,err)
}
if buf.String() != "" {
lines := strings.Split(buf.String(), "\n")
if len(lines) > 0 {
for _, l := range lines {
if l != "" {
return strings.Trim(l," ")
}
}
}
}
return ""
}
...@@ -105,7 +105,7 @@ func (p *Pai) GetConfig() bool { ...@@ -105,7 +105,7 @@ func (p *Pai) GetConfig() bool {
return true return true
} }
} else if pai.GetArchType() == "x86_64" { } else if pai.GetArchType() == "x86_64" {
uuid := cmd.GetLocalUUID() uuid := cmd.GetLocalUUID2()
if uuid != "" { if uuid != "" {
p.Serial = uuid p.Serial = uuid
return true return true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment