liuxiaolong
2019-12-19 3be90a02fc4eafb68e5b7e255e5125980295e235
fix bug
1个文件已修改
11 ■■■■ 已修改文件
service/SysService.go 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/SysService.go
@@ -171,13 +171,13 @@
            return false,errors.New("获取升级压缩包md5失败")
        }
        if strMd5 == identifier {
            if util.ZipCheck(zipFilePath + ext) {
            if util.ZipCheck(zipFilePath) {
                if !updatePatch(identifier, ext) {
                    return false,errors.New("执行升级过程异常")
                }
                return true,nil
            } else {
                logger.Debug("not a valid zip file,path:",zipFilePath+ext)
                logger.Debug("not a valid zip file,path:",zipFilePath)
                return false,errors.New("升级程序解压失败,请确定上传的补丁是zip格式")
            }
        } else {
@@ -207,14 +207,15 @@
            return false
        }
    }
    err := util.UnZip(configPatchPath+"/"+identifier+ext, unZipPath)
    zipFilePath := configPatchPath+"/"+identifier+ext
    err := util.UnZip(zipFilePath, unZipPath)
    if err !=nil {
        logger.Debug("UnZip err:",err,"zipFile:",configPatchPath+"/"+identifier+ext)
        logger.Debug("UnZip err:",err,"zipFile:",zipFilePath)
        return false
    }
    //2.更新系统
    var cmd *exec.Cmd
    updateCmd := fmt.Sprintf("setsid ./updatePatch.sh %s %s %s",unZipPath,configPatchPath+"/"+identifier+ext,configPatchPath+"/"+identifier)
    updateCmd := fmt.Sprintf("setsid ./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))