From c514f25ed39ff47e96096376e6006a95b806e6d5 Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期三, 03 六月 2020 11:56:47 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/webserver --- service/SdkInstall.go | 62 +++++++++++++++++-------------- 1 files changed, 34 insertions(+), 28 deletions(-) diff --git a/service/SdkInstall.go b/service/SdkInstall.go index da65aa3..c0d784b 100644 --- a/service/SdkInstall.go +++ b/service/SdkInstall.go @@ -2,6 +2,7 @@ import ( "basic.com/dbapi.git" + //"basic.com/dbapi.git" "basic.com/valib/logger.git" "encoding/json" "errors" @@ -68,7 +69,8 @@ } unPackFilePath := configPatchPath+"/"+identifier+ext - err := util.UnTarGz(unPackFilePath, unPackPath) + logger.Debug("unPackFilePath:", unPackFilePath, "unPackPath:", unPackPath) + _,err := util.UnTarGzByCmd(unPackFilePath, unPackPath) if err !=nil { logger.Debug("UnPack err:",err,"unPackFile:",unPackFilePath) return false, err @@ -107,33 +109,6 @@ soM := make(map[string]SdkDef) var skDefArr []SdkDef if err = json.Unmarshal(defB, &skDefArr);err == nil { - zconfPath := "/opt/vasystem/bin/zconf/" - libPath := "/opt/vasystem/libs/" - if !util.DirExists(zconfPath) { - os.MkdirAll(zconfPath, 0777) - } - if !util.DirExists(libPath) { - os.MkdirAll(libPath, 0777) - } - for sdkType,_ := range soM { - //鍏堣В鍘婼dkType.tar.gz鏂囦欢 - if unTarGzE := util.UnTarGz(unPackPath+sdkType+".tar.gz", unPackPath);unTarGzE == nil { - //澶嶅埗json鍚姩鏂囦欢 - if util.Exists(unPackPath+sdkType+"/zconf/"+sdkType+".json") { - util.CopyFile(unPackPath+sdkType+"/zconf/"+sdkType+".json", zconfPath) - } - if util.DirExists(unPackPath+sdkType+"/"+sdkType) { - if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/"+sdkType, libPath);cE != nil { - return false, cE - } - } - if util.DirExists(unPackPath+sdkType+"/models") { - if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/models", "/opt/vasystem/bin/"); cE != nil { - return false, cE - } - } - } - } //娉ㄥ唽绠楁硶淇℃伅鍜岀畻娉曞弬鏁板埌dbserver var sdkApi dbapi.SdkApi for _,skd := range skDefArr { @@ -166,8 +141,39 @@ srv.Args = append(srv.Args, sra) } paramBody := util.Struct2Map(srv) + logger.Debug("sdkApi.Register paramBody:", paramBody) sdkApi.Register(paramBody) //灏嗙畻娉曟敞鍐屽埌鏁版嵁搴撲腑 } + zconfPath := "/opt/vasystem/bin/zconf/" + libPath := "/opt/vasystem/libs/" + if !util.DirExists(zconfPath) { + os.MkdirAll(zconfPath, 0777) + } + if !util.DirExists(libPath) { + os.MkdirAll(libPath, 0777) + } + for sdkType,_ := range soM { + //鍏堣В鍘婼dkType.tar.gz鏂囦欢 + if unTarGzE := util.UnTarGz(unPackPath+sdkType+".tar.gz", unPackPath);unTarGzE == nil { + //澶嶅埗json鍚姩鏂囦欢 + if util.Exists(unPackPath+sdkType+"/zconf/"+sdkType+".json") { + util.CopyFile(unPackPath+sdkType+"/zconf/"+sdkType+".json", zconfPath+sdkType+".json") + } + if util.DirExists(unPackPath+sdkType) { + if _,cE := util.CopyDirByCmd(unPackPath+sdkType, libPath);cE != nil { + return false, cE + } + } + if util.DirExists(unPackPath+sdkType+"/models") { + if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/models", "/opt/vasystem/bin/zconf"); cE != nil { + return false, cE + } + } + } else { + logger.Debug("unTarGzE sdkType.tar.gz err:", unTarGzE) + } + } + } else { return false, errors.New("鍙嶅簭鍒楀寲绠楁硶瀹氫箟淇℃伅澶辫触") } -- Gitblit v1.8.0