Improve lua build process + folder structure
This commit is contained in:
@@ -23,11 +23,22 @@ app.mount("/tiles/", map_tiles)
|
||||
app.mount("/ipmi/", monitoring)
|
||||
app.mount("/api/", api)
|
||||
|
||||
installer = j2env.get_template("install.lua").render(deploy_path=settings.deploy_path)
|
||||
|
||||
def render_lua_installer():
|
||||
with open(f"{settings.lua_out_path}/manifest.txt", "r") as f:
|
||||
file_list = [name.strip() for name in f.readlines()]
|
||||
return j2env.get_template("install.lua").render(
|
||||
deploy_path=settings.deploy_path, file_list=file_list
|
||||
)
|
||||
|
||||
|
||||
installer = render_lua_installer()
|
||||
|
||||
|
||||
@app.get("/install")
|
||||
async def get_installer():
|
||||
if settings.dev_mode:
|
||||
installer = render_lua_installer()
|
||||
return PlainTextResponse(installer)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local args = { ... }
|
||||
|
||||
local token = args[1]
|
||||
|
||||
local existing = fs.exists("auth.lua")
|
||||
if not token and not existing then
|
||||
error("A token is required.")
|
||||
@@ -16,8 +16,8 @@ elseif token then
|
||||
error("Token failed!")
|
||||
end
|
||||
end
|
||||
local files = { "main.lua", "json.lua", "framebuffer.lua", "ringbuffer.lua", "socket.lua" }
|
||||
local files = { {% for filename in file_list %} "{{ filename }}", {% endfor %} }
|
||||
for _, file in ipairs(files) do
|
||||
fs.delete(file)
|
||||
shell.run(("wget %s/lua/%s"):format(path, file))
|
||||
shell.run(("wget %s/lua/%s %s"):format(path, file, file))
|
||||
end
|
||||
Reference in New Issue
Block a user