Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("This is the installer for Xelo's storage system (client).")
- if (fs.exists("/storage")) then
- error("The path /storage is already in use. Please rename or remove this folder to continue the installation.")
- end
- if (fs.exists("/startup") or fs.exists("/startup.lua")) then
- error("The filename startup.lua is already used. Please rename or remove this file to continue the installation.")
- end
- local baseURL = "http://bambootown.online:25556"
- local mainPage = http.get(baseURL .. "/filesClient.txt")
- assert(mainPage, "Failed to reach the webserver!")
- local filesRaw = mainPage.readAll()
- mainPage.close()
- print("Files to read:\n" .. filesRaw)
- fs.makeDir("/storage")
- print("Installing...")
- for name in filesRaw:gmatch("[^%s]+") do
- local page = http.get(baseURL .. "/getClient/" .. name)
- assert(page, "Failed to reach the webserver!")
- local fileRaw = page.readAll()
- page.close()
- local file = fs.open("/storage/" .. name, "w")
- file.write(fileRaw)
- file.close()
- end
- local startupFile = fs.open("/startup.lua", "w")
- startupFile.write("shell.run(\"/storage/run.lua\")")
- startupFile.close()
- print("Success: downloaded all files!")
- print("Rebooting...")
- sleep(3)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement