wyvern/installer.lua

38 lines
1.1 KiB
Lua
Raw Normal View History

2018-07-26 09:48:51 +00:00
local wyvern_files = {
root = "https://osmarks.tk/git/osmarks/wyvern/raw/branch/master/",
2018-08-14 21:17:23 +00:00
files = { "installer.lua", "luadash.lua", "readline.lua", "lib.lua", "backend-chests.lua", "client.lua", "fuzzy.lua", "IO.lua" }
2018-07-26 09:48:51 +00:00
}
local args = {...}
2018-07-26 10:00:42 +00:00
local command = args[1]
2018-07-26 09:48:51 +00:00
local function download_group(g)
2018-07-26 10:00:42 +00:00
for _, file in pairs(g.files) do
2018-07-26 09:59:05 +00:00
local url = g.root .. file
local h = http.get(url)
local contents = h.readAll()
local f = fs.open(file, "w")
f.write(contents)
f.close()
print("Written", file, "from", url)
2018-07-26 10:00:42 +00:00
end
2018-07-26 09:48:51 +00:00
end
local function prompt(msg)
write(msg .. "> ")
return read()
end
local function install_wyvern() download_group(wyvern_files) end
if command == "update" then
install_wyvern()
elseif command == "install" then
install_wyvern()
shell.run "edit wyvern_config.tbl" -- open editor for config edits
2018-08-13 07:30:36 +00:00
write "Program to run on startup |> "
local program = read()
local f = fs.open("startup", "w")
f.write('shell.run "' .. program .. '"')
f.close()
os.reboot()
2018-07-26 09:48:51 +00:00
end