| | |
| | | unZipPath := configPatchPath+"/"+identifier+"_basic/" |
| | | if util.Exists(unZipPath) { |
| | | //此版本已经更新过 |
| | | rmErr := os.Remove(unZipPath) |
| | | rmErr := os.RemoveAll(unZipPath) |
| | | if rmErr !=nil { |
| | | return false |
| | | } |
| | | } else { |
| | | if !util.CreateDirectory(unZipPath) { |
| | | return false |
| | | } |
| | | } |
| | | if !util.CreateDirectory(unZipPath) { |
| | | return false |
| | | } |
| | | |
| | | zipFilePath := configPatchPath+"/"+identifier+ext |
| | | err := util.UnZip(zipFilePath, unZipPath) |
| | | if err !=nil { |
| | |
| | | } |
| | | //2.更新系统 |
| | | var cmd *exec.Cmd |
| | | updateCmd := fmt.Sprintf("setsid ./updatePatch.sh %s %s %s",unZipPath,zipFilePath,configPatchPath+"/"+identifier) |
| | | updateCmd := fmt.Sprintf("./updatePatch.sh %s %s %s &",unZipPath,zipFilePath,configPatchPath+"/"+identifier) |
| | | cmd = exec.Command("/bin/sh","-c", updateCmd) |
| | | if b, err := cmd.Output(); err != nil { |
| | | logger.Debug("updatePatch err:",err,"result:",string(b)) |