Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function invoke(address,method,...)
- local result = table.pack(pcall(component.invoke,address,method,...))
- if not result[1] then
- return nil,result[2]
- else
- return table.unpack(result,2,result.n)
- end
- end
- local cp = 1
- local gpu = component.list("gpu")()
- local screen = component.list("screen")()
- invoke(screen,"turnOff")
- invoke(screen,"turnOn")
- if gpu and screen then
- invoke(gpu,"bind",screen)
- end
- function print(string)
- invoke(gpu,"set",1,cp,string)
- cp=cp+1
- end
- function loadOS(address)
- local handle = invoke(address,"open","/init.lua")
- local data = invoke(address,"read",handle,math.huge)
- invoke(address,"close,handle")
- load(data,"=init")
- init()
- end
- print("Loading JBIOS....")
- print("Finding Bootable Devices....")
- filesys = {}
- c=1
- for addr in component.list("filesystem")do
- filesys[c]=address-------------<<<Always empty
- print(address)--------<<<<<<<always blank
- c=c+1
- end
- i=1
- i0=1
- boots = {}
- while i<11 do
- if filesys[i] then
- bool = invoke(filesys[i],"exists","/init.lua")
- if bool then
- boots[i0]=filesys[i]
- i0=i0+1
- end
- end
- i=i+1
- end
- print("Found: "..#boots.." Bootable Filesystems")-----------always 0
- i=1
- print("Please Select Filesystem to boot from")
- while boots[i] do
- label = invoke(boots[i],"getLabel")
- print(i..": "..label)
- i=i+1
- end
- print("b: Boot Now")
- print("Will auto boot in ten seconds if you dont select a system to boot.")
- time = os.time()+11
- codes = {0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x30}
- code = 0x00
- while os.time()<=time do
- local ev,addr,char,code,name = computer.pullSignal(10)
- if(ev=="key_down")then
- i1=1
- if code==0x02 or code==0x03 or code==0x04 or code==0x05 or code==0x06 or code==0x07 or code==0x08 or code==0x09 or code==0x0A or code==0x0B then
- loadOS(boots[code])
- break
- elseif code==11 then
- char0=char
- break
- end
- end
- end
- if not computer.getBootAddress() then
- loadOS(computer.getBootAddress())
- else
- loadOS(boots[1])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement