Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CRAFTLOADER BOOTABLE MEDIA
- os.pullEvent = os.pullEventRaw
- settings.load()
- local args = {...}
- local function PrintDoneMsg()
- term.setTextColor(colors.green)
- print("Done.")
- term.setTextColor(colors.white)
- end
- local function MakeLog( message, error, whileRunning )
- local file = fs.open("crash_report.log", "a")
- file.write("[CRITICAL ERROR WHILE " .. whileRunning .. "]\n[ERROR] " .. error .. " : " .. message)
- file.close()
- end
- if settings.get("bootFailed", 0) >= 3 then
- if settings.get("runRecoveryProgram", false) == true then
- if fs.exists("recovery.lua") then
- shell.run("recovery.lua")
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Chacking device characteristics...")
- if not term.isColor() then
- shell.run("/bin/BSOD", "\"[DO:0005] Unsupported device\"")
- elseif turtle then
- shell.run("/bin/BSOD", "\"[DO:0005] Unsupported device\"")
- elseif pocket then
- shell.run("/bin/BSOD", "\"[DO:0005] Unsupported device\"")
- end
- PrintDoneMsg()
- print("Chacking file integrity...")
- if not fs.exists("/boot/init") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/main") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.UninstallDialog") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.command") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.programs") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.shutdown") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.uninstall") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/install") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- elseif not fs.exists("/bin/.sleep") then
- settings.set("bootFailed", settings.get("bootFailed", 0) + 1)
- settings.save()
- MakeLog("CRITICAL FILE DOES NOT EXIST", "DO:0003", "BOOTING")
- shell.run("/bin/BSOD", "\"[DO:0003] Critical file corrupted\"")
- end
- PrintDoneMsg()
- settings.set("bootFailed", 0)
- print("Botting System...")
- term.clear()
- term.setCursorPos(1,1)
- settings.save()
- shell.run("/boot/init", table.concat(args, " "))
Advertisement
Add Comment
Please, Sign In to add comment