Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this script runs at start, ensures handbook is setup, and if not, will prompt user to run setup on external device
- local Req_Files = {}
- local Boot_Operation = {}
- --Initial Setup Addresses
- local Settings_File = nil
- local Start_File = nil
- local Update_Folder = nil
- --Boot Run
- local function Complete()
- local BOS = fs.open("bootlist.sys","r")
- Boot_Operation = textutils.unserialize(BOS.readAll())
- BOS.close()
- for i = 1, #Boot_Operation do
- shell.run(Boot_Operation[i],"boot")
- end
- local CheckUpdate = fs.find("rom/*/UpdateDetails.txt")
- if CheckUpdate ~= nil then Update_Folder = fs.getDir(CheckUpdate) end
- local CheckSettings = fs.find("rom/*/SystemSettings.txt")
- if CheckSettings ~= nil then Settings_File = CheckSettings end
- Start_File = fs.find("rom/*/System1.lua")
- local file = fs.open("bootresults.sys","w")
- file.write(textutile.serialize({{"Settings",Settings_File},{"Update",Update_Folder},{"Start",Start_File},{"Required",Req_Files}})
- file.close()
- shell.run(Start_File,"Boot")
- end
- local function ErrorPrompt(text)
- local w, h = term.getSize()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(w/2 - text:len()/2, h/2)
- term.write(text)
- os.sleep(30)
- os.shutdown()
- end
- local function CheckFiles()
- Missing = {}
- for i = 1, #Req_Files do
- if fs.exists(Req_Files[i]) then else Missing[#Missing + 1] = Req_File[i] end
- end
- Text = "Missing: \n"
- for i = 1, #Missing do
- Text = Text+Missing[i]+"\n"
- end
- if #Missing > 0 then ErrorPrompt(Text) else Complete() end
- end
- local function CheckDir()
- local i = 1
- local Line = nil
- local DIR = fs.open("System_Dir.txt","r")
- repeat Line = DIR.readLine() if Line ~= nil then Req_Files[i] = DIR.readLine() i = i + 1 end until Line == nil
- DIR.close()
- CheckFiles()
- end
- local function IntialStart()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- if fs.exist("System_Dir.txt") then CheckDir() else ErrorPrompt("missing directionary") end
- end
- IntialStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement