controlpanel/server/templates/install.lua

23 lines
642 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 = { {% for filename in file_list %} "{{ filename }}", {% endfor %} }
for _, file in ipairs(files) do
fs.delete(file)
shell.run(("wget %s/lua/%s %s"):format(path, file, file))
end