Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local filesystem = require "filesystem"
- local component = require "component"
- local process = require "process"
- local bootloader = [[
- local proxy = ...
- local filesystem = require "filesystem"
- local component = require "component"
- local term = require "term"
- local maxResX,maxResY = component.gpu.maxResolution()
- if maxResX >= 80 and maxResY >= 25 then
- component.gpu.setResolution(80,25)
- end
- term.clear()
- print("SKS-BOOT\a")
- for k,v in component.list() do
- if v == "filesystem" then
- if filesystem.proxy(k).getLabel() ~= nil then
- print(k,filesystem.proxy(k).getLabel())
- else
- print(k)
- end
- end
- end
- print("\nBoot device:")
- local rPartPath = io.read()
- local partPath = rPartPath:sub(1,rPartPath:len()-1)
- filesystem.umount("/")
- filesystem.mount(component.proxy(component.get(partPath)),"/")]]
- local revRunningFrom = process.running():reverse()
- local rFrFiSl = revRunningFrom:find("/")
- local runningFrom = process.running():sub(1,-rFrFiSl-1)
- print "SKS-OS installer"
- print("Running from: "..runningFrom)
- print "Install to:"
- local insLoc = io.read()
- print("Install to "..insLoc)
- print("Confirm Y/N")
- local conf = io.read():lower()
- if conf == "n" then
- error "operation cancelled"
- end
- print("Make directory: /bin")
- filesystem.makeDirectory(insLoc.."/bin")
- print("Make directory: /lib")
- filesystem.makeDirectory(insLoc.."/lib")
- print("Make directory: /usr")
- filesystem.makeDirectory(insLoc.."/usr")
- print("Make directory: /usr/man")
- filesystem.makeDirectory(insLoc.."/usr/man")
- print("Make directory: /etc")
- filesystem.makeDirectory(insLoc.."/etc")
- print("Make directory: /home")
- for f in filesystem.list("/bin") do
- print(f)
- filesystem.copy("/bin/"..f,insLoc.."/bin/"..f)
- end
- for f in filesystem.list("/lib") do
- print(f)
- filesystem.copy("/lib/"..f,insLoc.."/lib/"..f)
- end
- for f in filesystem.list("/usr/man") do
- print(f)
- filesystem.copy("/usr/man/"..f,insLoc.."/usr/man/"..f)
- end
- local fObj = io.open(insLoc.."/autorun.lua","w")
- fObj:write(bootloader)
- fObj:close()
- local filesystem = nil
- local component = nil
- local process = nil
- local insLoc = nil
- local bootloader = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement