Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function yNt()
- local n=1
- while true do
- local x, y=term.getCursorPos()
- term.clearLine()
- if n==1 then write(">No< Yes") else write (" No >Yes<") end
- term.setCursorPos(x, y)
- a, b=os.pullEvent("key")
- if b==263 and n==2 then n=1 end
- if b==262 and n==1 then n=2 end
- if b==257 then
- print("")
- if n==1 then return false end
- if n==2 then return true end
- end
- end
- end
- function nYt()
- local n=2
- while true do
- local x, y=term.getCursorPos()
- term.clearLine()
- if n==1 then write(">No< Yes") else write (" No >Yes<") end
- term.setCursorPos(x, y)
- a, b=os.pullEvent("key")
- if b==263 and n==2 then n=1 end
- if b==262 and n==1 then n=2 end
- if b==257 then
- print("")
- if n==1 then return false end
- if n==2 then return true end
- end
- end
- end
- if fs.exists("/CB/CustomBiosUpdate") then
- term.setTextColour(colours.white)
- versions = fs.open("/CB/CustomBiosUpdate", "r")
- VCBios = versions.readLine()
- Vredstone = versions.readLine()
- Vdoorlock = versions.readLine()
- Vnasclient = versions.readLine()
- versions.close()
- if not fs.exists("/CB/Prog/") then
- shell.run("mkdir /CB/Prog")
- end
- if not fs.exists("/CB/Prog/ROEdit") then
- shell.run("pastebin get yRtcxB91 /CB/Prog/ROEdit")
- end
- if not fs.exists("/mkNASserver") then
- launch = fs.open("/mkNASserver", "w")
- launch.write("write('Are you sure? (y or n) ')")
- launch.write("input = read()")
- launch.write("if input == 'y' then ")
- launch.write("shell.run('pastebin get 5WgxqxCv /CB/NAS')")
- launch.write("shell.run('/CB/NAS')")
- launch.write("end")
- launch.close()
- end
- if not fs.exists("/redstone") then
- launch = fs.open("/redstone", "w")
- launch.write("shell.run('/CB/Prog/redstone')")
- launch.close()
- end
- if not fs.exists("/NAS") then
- launch = fs.open("/NAS", "w")
- launch.write("shell.run('/CB/Prog/NAS')")
- launch.close()
- end
- if not fs.exists("/doorlock") then
- Dlaunch = fs.open("/doorlock", "w")
- Dlaunch.write("shell.run('/CB/Prog/doorlock')")
- Dlaunch.close()
- end
- if fs.exists ("/CB/Prog/NAS") then
- nas = fs.open("/CB/Prog/NAS", "r")
- Vanasclient = nas.readLine()
- nas.close()
- end
- if fs.exists ("/CB/Prog/redstone") then
- red = fs.open("/CB/Prog/redstone", "r")
- Varedstone = red.readLine()
- red.close()
- end
- if fs.exists ("/CB/Prog/doorlock") then
- dor = fs.open("/CB/Prog/doorlock", "r")
- Vadoorlock = dor.readLine()
- dor.close()
- end
- if not fs.exists("/CB/Prog/redstone") or Varedstone ~= Vredstone then
- if fs.exists ("/CB/Prog/redstone") then
- fs.delete("/CB/Prog/redstone")
- end
- shell.run("pastebin get wVKudGMs /CB/Prog/redstone")
- term.setTextColour(colours.green)
- print("Redstone updated")
- os.sleep(0.5)
- term.setTextColour(colours.white)
- fs.delete("/CB/Files/PachNotes")
- pnotes = 1
- end
- if not fs.exists("/CB/Prog/NAS") or Vanasclient ~= Vnasclient then
- if fs.exists ("/CB/Prog/NAS") then
- fs.delete("/CB/Prog/NAS")
- end
- shell.run("pastebin get 3aJs6E2C /CB/Prog/NAS")
- term.setTextColour(colours.green)
- print("NasClient updated")
- os.sleep(0.5)
- term.setTextColour(colours.white)
- fs.delete("/CB/Files/PachNotes")
- pnotes = 1
- end
- if not fs.exists("/CB/Prog/doorlock") or Vadoorlock ~= Vdoorlock then
- if fs.exists ("/CB/Prog/doorlock") then
- fs.delete("/CB/Prog/doorlock")
- end
- shell.run("pastebin get QHa2NjJn /CB/Prog/doorlock")
- term.setTextColour(colours.green)
- print("DoorLock updated")
- os.sleep(0.5)
- term.setTextColour(colours.white)
- fs.delete("/CB/Files/PachNotes")
- pnotes = 1
- end
- if not fs.exists("/CB/Files/PachNotes") or not fs.exists("/PNotes") then
- shell.run("pastebin get gCPerRc3 /CB/Files/PachNotes")
- term.setTextColour(colours.green)
- print("PachNotes updated")
- os.sleep(0.5)
- term.setTextColour(colours.white)
- pn = fs.open("/PNotes", "w")
- pn.writeLine("shell.run('/CB/Files/PachNotes')")
- pn.close()
- pnotes = 1
- end
- end
- term.setTextColour(colours.yellow)
- if not fs.exists ("/CB/password") then
- password = fs.open("/CB/password", "w")
- print ("Do you want to use a password ?")
- if yNt() == true then
- write("enter your password : ")
- local entrepass=read()
- write("confirm your password : ")
- local verifpass=read()
- if entrepass ~= verifpass then
- term.setTextColour(colours.red)
- print("passwords are not corresponding")
- password.close()
- fs.delete("/CB/password")
- os.sleep(2)
- os.reboot()
- end
- password.write(entrepass)
- password.close()
- term.setTextColour(colours.green)
- print("password is set.")
- os.sleep(2)
- os.reboot()
- end
- print("Do you want to use a disk security ?")
- if yNt() == true then
- print("Insert a disk and press a key")
- local e, k = os.pullEvent( "key" )
- if not fs.exists("/disk/") then
- password.write("slt")
- password.close()
- fs.delete("/CB/password")
- print ("You need to insert a disk")
- os.sleep(2)
- os.reboot()
- end
- security = math.random(10000000000000)
- disksecure = fs.open("/CB/diskpass", "w")
- disksecure.write(security)
- disksecure.close()
- disquette = fs.open("/disk/secure", "w")
- disquette.write(security)
- disquette.close()
- password.write("disk")
- password.close()
- term.setTextColour(colours.green)
- print("Disk security set")
- os.sleep(2)
- os.reboot()
- end
- password.write("none")
- password.close()
- end
- shell.run("clear")
- term.setTextColour(colours.blue)
- print 'Computercraft CustomBios V. 2.0.16'
- term.setTextColour(colours.brown)
- testpass = fs.open("/CB/password", "r")
- local passwd = testpass.readLine()
- if passwd ~= "none" and passwd ~= "disk" then
- write("password : ")
- local pass=read("*")
- if pass ~= passwd then
- term.setTextColour(colours.red)
- print ("Indvalid password")
- testpass.close()
- os.sleep(2)
- os.reboot()
- end
- end
- if passwd == "disk" then
- if not fs.exists("/disk/secure") then
- print("insert the security disk and press a key")
- local e, k = os.pullEvent( "key" )
- end
- if not fs.exists("/disk/secure") then
- term.setTextColour(colours.red)
- print("Wrong disk")
- os.sleep(2)
- os.reboot()
- end
- disk = fs.open("/disk/secure", "r")
- passw = fs.open("/CB/diskpass", "r")
- disk2 = disk.readLine()
- passw2 = passw.readLine()
- if disk2 ~= passw2 then
- term.setTextColour(colours.red)
- print("Wrong disk")
- disk.close()
- passw.close()
- os.sleep(2)
- os.reboot()
- else
- term.setTextColour(colours.green)
- disk.close()
- passw.close()
- print("Disk OK")
- settings.set("shell.allow_disk_startup", false)
- term.setTextColour(colours.white)
- end
- end
- testpass.close()
- term.setTextColour(colours.white)
- write 'Checking config'
- function Done()
- term.setTextColour(colours.green)
- os.sleep(0.25)
- print ' [done]'
- term.setTextColour(colours.white)
- end
- function yN()
- local n=1
- local t=5
- os.startTimer(1)
- while true do
- local x, y=term.getCursorPos()
- term.clearLine()
- if n==1 then write(">CustomOS< CraftOS ") else write (" CustomOS >CraftOS< ") end
- term.setTextColour(colours.white)
- write(t)
- term.setTextColour(colours.red)
- term.setCursorPos(x, y)
- a, b=os.pullEvent()
- while a~="key" and a~="timer" do a, b=os.pullEvent() end
- if a=="timer" then
- t=t-1
- os.startTimer(1)
- end
- if t==-1 then print("") break end
- if b==263 and n==2 then n=1 end
- if b==262 and n==1 then n=2 end
- if b==257 then print("") break end
- end
- if n==1 then return true end
- if n==2 then return false end
- return false
- end
- Done()
- if fs.exists("/CB/doorlock") then
- shell.run("/CB/Prog/doorlock")
- end
- if fs.exists("/CB/NAS") then
- shell.run("/CB/NAS")
- end
- if not fs.exists("/CB/OSset") and term.isColor() then
- set = fs.open("/CB/OSset", "w")
- set.write("selected")
- set.close()
- write 'Checking type of computer'
- if pocket then
- Done()
- term.setTextColour(colours.red)
- print ("Do you want to install sPhone ?")
- if nYt() == true then
- shell.run("pastebin run HsJSnhKQ")
- end
- else
- Done()
- end
- term.setTextColour(colours.red)
- print ("Do you want to install OneOS ?")
- if nYt() == true then
- shell.run("pastebin run E1xftzLa")
- end
- else
- set = fs.open("/CB/OSset", "w")
- set.write("selected")
- set.close()
- end
- term.setTextColour(colours.white)
- write 'Checking installed OS'
- if fs.exists("/startup") then
- Done()
- term.setTextColour(colours.red)
- if yN()==false then
- term.setTextColour(colours.white)
- write 'Loading OS'
- os.sleep(0.5)
- Done()
- if pnotes == 1 then
- os.sleep(0.5)
- term.setTextColour(colours.yellow)
- print ("To see Patch Notes, type 'PNotes'")
- term.setTextColour(colours.white)
- end
- shell.run("/rom/programs/shell")
- end
- term.setTextColour(colours.white)
- if fs.exists("/System/main.lua") and not fs.exists("/CB/pach") then
- print ('Paching oneOS...')
- shell.run("rm /System/main.lua")
- shell.run("pastebin get Wb8SHJMA /System/main.lua")
- write 'Pached oneOS'
- patch = fs.open("/CB/pach", "w")
- patch.write("done")
- patch.close()
- Done()
- end
- else
- Done()
- end
- write 'Loading OS'
- os.sleep(0.5)
- Done()
- if pnotes == 1 then
- term.setTextColour(colours.yellow)
- print ("To see Patch Notes, type 'PNotes'")
- term.setTextColour(colours.white)
- end
- os.sleep(0.5)
Add Comment
Please, Sign In to add comment