Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local internet = require("internet")
- local io = require("io")
- local filesystem = require("filesystem")
- local computer = require("computer")
- local component = require("component")
- local disk = component.proxy(computer.getBootAddress())
- function split(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function download(url, directory)
- filesystem.makeDirectory(directory)
- local filesStr = ""
- for i in internet.request(url) do
- filesStr = i
- end
- local files = split(filesStr,"&")
- for i=1,#files do
- local value = ""
- for i in internet.request(files[i]) do
- value = value..i
- end
- local is, di = string.find(files[i], "/[^/]*$")
- local filename = string.sub(files[i], is + 1)
- local file = io.open(directory.."/"..filename,"w")
- print(directory.."/"..filename)
- file:write(value)
- file:close()
- end
- end
- print("Install RedOS 1.2 [Beta]? [Y/n]")
- local ans = io.read()
- if (ans == "Y") or (ans == "y") then
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_1.txt","/etc")
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_2.txt","/home")
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_3.txt","/lib/core")
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_4.txt","/lib")
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_5.txt","/RedOS")
- download("https://raw.githubusercontent.com/LexaDriver/RedOS_indev/master/Downloads/list_6.txt","/RedOS")
- disk.setLabel("RedOS 1.2")
- print("Reboot now? [Y/n]")
- ans = io.read()
- if (ans == "Y") or (ans == "y") then
- computer.shutdown(true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement