2023-10-08 10:04:21 +02:00
|
|
|
local args = { ... }
|
|
|
|
|
|
|
|
local target_branch = "main"
|
|
|
|
local bin_path = "/bin/"
|
|
|
|
local lib_path = "/lib/"
|
|
|
|
local startup_path = "/startup/"
|
|
|
|
|
|
|
|
|
2023-10-08 10:06:34 +02:00
|
|
|
function download(remote_path, local_path)
|
2023-10-08 10:04:21 +02:00
|
|
|
io.write("Downloading " .. remote_path .. " to " .. local_path .. "\n")
|
2023-10-08 10:06:34 +02:00
|
|
|
response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path, nil)
|
2023-10-08 10:04:21 +02:00
|
|
|
if response.getResponseCode() == 200 then
|
|
|
|
file = fs.open(local_path, "w")
|
|
|
|
file.write(response.readAll())
|
|
|
|
file.close()
|
|
|
|
else
|
2023-10-08 10:06:34 +02:00
|
|
|
io.write("Failed to update " .. remote_path .. "\n")
|
2023-10-08 10:04:21 +02:00
|
|
|
io.write(response)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Startup
|
2023-10-08 10:06:34 +02:00
|
|
|
download("utils/lsh.lua", startup_path .. "lsh.lua")
|
2023-10-08 10:04:21 +02:00
|
|
|
|
|
|
|
-- Lib
|
2023-10-08 10:47:35 +02:00
|
|
|
download("lib/auth.lua", lib_path .. "auth.lua")
|
2023-10-08 10:06:34 +02:00
|
|
|
download("lib/lns.lua", lib_path .. "lns.lua")
|
|
|
|
download("lib/lum.lua", lib_path .. "lum.lua")
|
2023-10-08 10:04:21 +02:00
|
|
|
|
|
|
|
-- Bin
|
2023-10-08 10:06:34 +02:00
|
|
|
download("lum.lua", bin_path .. "lum.lua")
|
2023-10-08 10:04:21 +02:00
|
|
|
|
|
|
|
-- Run lsh
|
|
|
|
ok = shell.run(startup_path .. "lsh.lua")
|
|
|
|
if not ok then
|
|
|
|
io.write("Failed to run lsh!\n")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Packages
|
|
|
|
lum.install("dig")
|
|
|
|
lum.install("auth")
|
|
|
|
|
|
|
|
io.write("Done!\n")
|