diff --git a/handler/cid.go b/handler/cid.go index 70094bb..344b9e2 100644 --- a/handler/cid.go +++ b/handler/cid.go @@ -61,16 +61,15 @@ func RunCID(c *gin.Context) { name = names[0] //脚本内容 - scriptContent := `#!/bin/bash - TARGET_DIR = ` + proto.CID_BASE_DIR + `workspace/` + name + ` - if [ ! -d $TARGET_DIR ]; then - git clone ` + cid.Url + ` - cd $TARGET_DIR - else - cd $TARGET_DIR - git pull - fi - ` + cid.Script + scriptContent := `TARGET_DIR = ` + proto.CID_BASE_DIR + `workspace/` + name + ` +if [ ! -d $TARGET_DIR ]; then + git clone ` + cid.Url + ` + cd $TARGET_DIR +else + cd $TARGET_DIR + git pull +fi +` + cid.Script //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run() @@ -193,16 +192,15 @@ func CIDCallback(c *gin.Context) { name := strs[len(strs)-1] names := strings.Split(name, ".") name = names[0] - scriptContent := `#!/bin/bash - TARGET_DIR = ` + proto.CID_BASE_DIR + `workspace/` + name + ` - if [ ! -d $TARGET_DIR ]; then - git clone ` + res.Url + ` - cd $TARGET_DIR - else - cd $TARGET_DIR - git pull - fi - ` + res.Script + scriptContent := `TARGET_DIR = ` + proto.CID_BASE_DIR + `workspace/` + name + ` +if [ ! -d $TARGET_DIR ]; then + git clone ` + res.Url + ` + cd $TARGET_DIR +else + cd $TARGET_DIR + git pull +fi +` + res.Script //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run()