Implement post-deploy execution from latest version of reload script

This commit is contained in:
Gabriel Tofvesson 2024-12-04 22:51:03 +01:00
parent 4997a94cfb
commit 0ff69b53f6

View File

@ -1,5 +1,16 @@
local CC_UTILS_DIR = "/cc-utilities"
local function onResume(scriptArgs)
if #scriptArgs > 0 then
scriptArgs[1] = CC_UTILS_DIR .. scriptArgs[1]
shell.run(table.unpack(scriptArgs))
end
end
if pcall(debug.getlocal, 4, 1) then
return { onResume = onResume }
end
local result, retval = pcall(fs.delete, CC_UTILS_DIR)
if fs.exists(CC_UTILS_DIR) then
if result then
@ -11,5 +22,6 @@ if fs.exists(CC_UTILS_DIR) then
end
shell.run("clone https://gitea.tofvesson.se/GabrielTofvesson/cc-utilities.git")
shell.run("bg")
shell.run("cc-utilities/itemcontroller")
local nextVersion = require(CC_UTILS_DIR .. "reload")
local _ = ((type(nextVersion) == "table" and type(nextVersion.onResume) == "function") and nextVersion.onResume or onResume)({...})