Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
e3b269ea
Commit
e3b269ea
authored
Jul 23, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取主板uuid 优化
parent
80437d8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
cmd.go
pkg/cmd/cmd.go
+14
-6
No files found.
pkg/cmd/cmd.go
View file @
e3b269ea
...
...
@@ -23,17 +23,26 @@ func GetLocalArchType() string {
}
func
GetLocalUuid
()
string
{
cmd
:=
exec
.
Command
(
"
bash"
,
"-c"
,
"dmidecode | grep UUID
"
)
var
buf
bytes
.
Buffer
cmd
:=
exec
.
Command
(
"
dmidecode
"
)
var
buf
,
errbuf
bytes
.
Buffer
cmd
.
Stdout
=
&
buf
cmd
.
Run
()
cmd
.
Stderr
=
&
errbuf
err
:=
cmd
.
Run
()
if
err
!=
nil
{
fmt
.
Println
(
"exec uuid"
,
err
)
}
fmt
.
Println
(
"err"
,
errbuf
.
String
())
fmt
.
Println
(
"uuid"
,
buf
.
String
())
if
buf
.
String
()
!=
""
{
lines
:=
strings
.
Split
(
buf
.
String
(),
"
\n
"
)
if
len
(
lines
)
>
0
{
return
strings
.
Trim
(
lines
[
0
],
" "
)
for
_
,
l
:=
range
lines
{
if
strings
.
Contains
(
l
,
"UUID"
)
{
return
strings
.
Trim
(
l
,
" "
)
}
}
}
return
""
}
return
""
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment