代码拉取完成,页面将自动刷新
const importUtil = import("util")
const importPath = import("path")
const versionLocal = function() {
const metaBin = importPath.pathMetaBin()
const versionFile = '{}/{}'.format(metaBin, 'version')
if (importUtil.guaFileExist(versionFile)) {
const c = 'cat {}'.format(versionFile)
const r = importUtil.call(c)
return importUtil.guaStringToInt(r)
} else {
return 0
}
}
const versionRemote = function() {
const c = 'curl https://gitee.com/kuaibiancheng/store/raw/master/version'
const r = importUtil.call(c)
var version = importUtil.guaStringToInt(r)
return version
}
const checkVersion = function() {
const l = versionLocal()
const r = versionRemote()
const isOldVersion = r > l
return isOldVersion
}
const replaceMeta = function() {
// 先把代码下载下来到临时目录
// 复制代码到 meta bin
// 删除临时目录
const pathTmp = '{}/tmp_repo'.format(importPath.pathHome())
const repoUrl = 'https://gitee.com/kuaibiancheng/store'
const commandGit = 'git clone --depth=1 {} {}'.format(repoUrl, pathTmp)
importUtil.call(commandGit)
const pathMetaBin = importPath.pathMetaBin()
const commandCp = 'cp -r {}/* {}'.format(pathTmp, pathMetaBin)
importUtil.call(commandCp)
updateGualang(pathTmp)
importUtil.guaFileRm(pathTmp)
}
const updateGualang = function(repoPath) {
const c1 = 'cp {}/gualang/* /usr/local/axe/meta'.format(repoPath)
const c2 = "chmod +x /usr/local/axe/meta/gualang"
importUtil.callWithoutOutput(c1)
importUtil.callWithoutOutput(c2)
}
const clear = function() {
const pathOutput = importPath.pathAsyncOutput()
importUtil.guaFileRm(pathOutput)
}
const updateStore = function() {
clear()
const isOldVersion = checkVersion()
if (isOldVersion) {
replaceMeta()
return true
} else {
return false
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。