update 2026-10-22 00:28:18

This commit is contained in:
action committed 2026-10-22 00:28:18 +08:00
1 parent a9612da342
commit 7d3acd4d45
168 files changed
+149 -38029

No files matched your search

@@ -565,31 +565,25 @@ local function fetch_geofile(geo_name, geo_type, url)
local sha_url = url:gsub((down_filename:gsub("(%W)", "%%%1")), down_filename .. ".sha256sum")
local sha_path = tmp_path .. ".sha256sum"
local function verify_sha256(sha_file)
return sys.call("sha256sum -c " .. sha_file .. " > /dev/null 2>&1") == 0
end
local digest
local sha_verify = select(1, curl(sha_url, sha_path)) == 0
if sha_verify then
local f = io.open(sha_path, "r")
if f then
local content = f:read("*l")
f:close()
if content then
content = content:gsub("(%x+)%s+.+", "%1 " .. tmp_path)
f = io.open(sha_path, "w")
if f then
f:write(content)
f:close()
end
local hash = content and content:match("^(%x+)%s")
if hash and #hash == 64 then
digest = "sha256:" .. hash
end
end
if fs.access(asset_path) then
sys.call(string.format("cp -f %s %s", asset_path, tmp_path))
if verify_sha256(sha_path) then
log(geo_type .. " 版本一致,无需更新。")
return 0
end
if not digest then
log(geo_type .. " SHA256 校验信息无效,更新失败。")
return 1
end
if fs.access(asset_path) and api.verify_sha256(asset_path, digest) then
log(geo_type .. " 版本一致,无需更新。")
return 0
end
end
@@ -605,7 +599,7 @@ local function fetch_geofile(geo_name, geo_type, url)
end
if sret_tmp == 0 then
if sha_verify then
if verify_sha256(sha_path) then
if api.verify_sha256(tmp_path, digest) then
sys.call(string.format("mkdir -p %s && mv -f %s %s", backup_path, asset_path, backup_path))
sys.call(string.format("mkdir -p %s && mv -f %s %s", asset_location, tmp_path, asset_path))
reboot = 1