controlpanel/server/templates/install.lua

23 lines
644 B
Lua

local args = { ... }
local token = args[1]
local existing = fs.exists("auth.lua")
if not token and not existing then
error("A token is required.")
end
local path = "{{ deploy_path }}"
if existing then
print("Found auth.lua, skipping")
elseif token then
print("Using token...")
shell.run(("wget %s/api/issue-id/%s auth.lua"):format(path, token))
if not fs.exists("auth.lua") then
error("Token failed!")
end
end
local files = { "main.lua", "json.lua", "framebuffer.lua", "ringbuffer.lua", "socket.lua" }
for _, file in ipairs(files) do
fs.delete(file)
shell.run(("wget %s/lua/%s"):format(path, file))
end