| | |
| | | package service |
| | | |
| | | import ( |
| | | "basic.com/valib/logger.git" |
| | | "bufio" |
| | |
| | | "mime/multipart" |
| | | "os" |
| | | "os/exec" |
| | | "strconv" |
| | | "strings" |
| | | "webserver/extend/config" |
| | | "webserver/extend/util" |
| | |
| | | return true |
| | | } |
| | | //判断分块文件是否存在 |
| | | chunkFilePath := fileTmpPath+"/"+arg.Identifier+"_"+strconv.Itoa(arg.ChunkNumber) |
| | | chunkAlignNum := util.FormatNum(arg.TotalChunks, arg.ChunkNumber) |
| | | chunkFilePath := fileTmpPath+"/"+arg.Identifier+"_"+chunkAlignNum |
| | | if !util.Exists(chunkFilePath) { |
| | | return false |
| | | } |
| | |
| | | return false |
| | | } |
| | | } |
| | | fileSavePath := fileTmpPath+"/"+MD5Str+"_"+strconv.Itoa(arg.ChunkNumber) |
| | | chunkAlignNum := util.FormatNum(arg.TotalChunks, arg.ChunkNumber) |
| | | fileSavePath := fileTmpPath+"/"+MD5Str+"_"+chunkAlignNum |
| | | if util.Exists(fileSavePath) { |
| | | rmErr := os.Remove(fileSavePath) |
| | | if rmErr != nil { |
| | |
| | | } |
| | | //2.更新系统 |
| | | var cmd *exec.Cmd |
| | | cmd = exec.Command("/bin/sh","-c",fmt.Sprintf("./updatePatch.sh %s",unZipPath)) |
| | | logger.Debug("called sh updatePatch.sh ", unZipPath) |
| | | updateCmd := fmt.Sprintf("setsid ./updatePatch.sh %s %s %s",unZipPath,configPatchPath+"/"+identifier+ext,configPatchPath+"/"+identifier) |
| | | cmd = exec.Command("/bin/sh","-c", updateCmd) |
| | | logger.Debug("called sh updatePatch.sh,updateCmd:",updateCmd) |
| | | if b, err := cmd.Output(); err != nil { |
| | | logger.Debug("updatePatch err:",err,"result:",string(b)) |
| | | return false |