iteration

This commit is contained in:
2023-10-08 04:04:21 -04:00
parent c9e6e5d229
commit f0233a640d
13 changed files with 130 additions and 111 deletions

45
install.lua Normal file
View File

@@ -0,0 +1,45 @@
local args = { ... }
local target_branch = "main"
local bin_path = "/bin/"
local lib_path = "/lib/"
local startup_path = "/startup/"
function download_lua(remote_path, local_path)
io.write("Downloading " .. remote_path .. " to " .. local_path .. "\n")
response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. program_name .. ".lua", nil)
if response.getResponseCode() == 200 then
file = fs.open(local_path, "w")
file.write(response.readAll())
file.close()
end
else
io.write("Failed to update " .. program_name .. ".lua\n")
io.write(response)
end
end
-- Startup
download_lua("utils/lsh.lua", startup_path .. "lsh.lua")
-- Lib
download_lua("lib/lns.lua", lib_path .. "lns.lua")
download_lua("lib/lum.lua", lib_path .. "lum.lua")
-- Bin
download_lua("lum.lua", bin_path .. "lum.lua")
-- 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")