提交 df1c146e 编写于 作者: Y yangrui07

fix md5check

上级 37a83001
......@@ -834,9 +834,17 @@ func GetFileName(source string) (fileName string) {
}
func checkMd5(file string, fileMd5 string) (err error) {
md5Cmd := fmt.Sprintf("./scripts/md5_checker %s %s", file, fileMd5)
cmd := fmt.Sprintf("md5sum %s | awk '{print $1}'", file)
stdout, _, _ := pipeline.Run(exec.Command("/bin/sh", "-c", cmd))
real_md5 := stdout.String()
cmd = fmt.Sprintf("cat %s | awk '{print $1}'", fileMd5)
stdout, _, _ = pipeline.Run(exec.Command("/bin/sh", "-c", cmd))
given_md5 := stdout.String()
_, _, err = pipeline.Run(exec.Command("/bin/sh", "-c", md5Cmd))
if real_md5 != given_md5 {
logex.Warningf("checkMd5 failed real_md5[%s] given_md5[%s]", real_md5, given_md5)
err = errors.New("checkMd5 failed")
}
return
}
......
logex @ bea1165f
Subproject commit bea1165feb7bc0cfb4c4dd4d0e96de4a927ef33d
pipeline @ 83bee103
Subproject commit 83bee10329eb396c8911d57bd05fc0a1992dd717
docopt-go @ ee0de3bc
Subproject commit ee0de3bc6815ee19d4a46c7eb90f829db0e014b1
rfw @ 6f0a6f32
Subproject commit 6f0a6f3266ba1058df9ef0c94cda1cecd2e62852
logex @ bea1165f
Subproject commit bea1165feb7bc0cfb4c4dd4d0e96de4a927ef33d
docopt-go @ ee0de3bc
Subproject commit ee0de3bc6815ee19d4a46c7eb90f829db0e014b1
rfw @ 6f0a6f32
Subproject commit 6f0a6f3266ba1058df9ef0c94cda1cecd2e62852
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册