Advertisement
DOGGYWOOF

KERNEL POWER CACHE ERROR

Nov 20th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. -- Clear the screen and set up colors
  2. term.clear()
  3. term.setBackgroundColor(colors.black)
  4. term.setTextColor(colors.white)
  5. term.clear()
  6.  
  7. -- Define the width and height of the screen
  8. local width, height = term.getSize()
  9.  
  10. -- Helper function to center text on the screen
  11. local function centerText(y, text, textColor)
  12. local x = math.floor((width - #text) / 2)
  13. term.setCursorPos(x, y)
  14. term.setTextColor(textColor)
  15. term.write(text)
  16. end
  17.  
  18. -- Function to display the error screen
  19. local function showErrorScreen()
  20. -- Display the dog ASCII art with red Xes for eyes
  21. local dogArt = {
  22. " |\\_/| ",
  23. " | ? ? KERNEL ERROR! ",
  24. " | <> _ ",
  25. " | _/\\------____ ((| |))",
  26. " | `--' | ",
  27. " _____|_ ___| |___. ",
  28. "/_/_____/____/_______| "
  29. }
  30.  
  31. local startLine = math.floor((height - #dogArt) / 2) - 2
  32.  
  33. -- Display the dog ASCII art with red Xes for eyes in red
  34. term.setTextColor(colors.red)
  35. for i, line in ipairs(dogArt) do
  36. centerText(startLine + i, line, colors.yellow)
  37. end
  38.  
  39. -- Display error message below the dog ASCII art in white
  40. term.setTextColor(colors.white)
  41. centerText(startLine + #dogArt + 2, "Kernel Power Loss", colors.white)
  42. centerText(startLine + #dogArt + 3, "", colors.white)
  43.  
  44. -- Move "Press F1 to continue boot" to the bottom in white
  45. centerText(height - 2, "Press F1 To continue boot", colors.white)
  46.  
  47. -- Listen for F1 key press to run /disk/boot/start-check.lua
  48. while true do
  49. local event, key = os.pullEvent("key")
  50. if key == keys.f1 then
  51. -- Run /disk/boot/start-check.lua if it exists
  52. if fs.exists("/disk/boot/start-check.lua") then
  53. shell.run("/disk/boot/start-check.lua")
  54. end
  55. break -- Exit the loop after F1 is pressed
  56. end
  57. end
  58. end
  59.  
  60. -- Check if /.tmp exists
  61. if fs.exists("/.tmp") then
  62. -- Show error screen if /.tmp exists and then continue boot
  63. showErrorScreen()
  64. else
  65. -- Create /.tmp if it doesn't exist
  66. local tmpFile = fs.open("/.tmp", "w")
  67. tmpFile.close()
  68.  
  69. -- Continue boot by running start-check.lua if it exists
  70. if fs.exists("/disk/boot/start-check.lua") then
  71. shell.run("/disk/boot/start-check.lua")
  72. else
  73. showErrorScreen()
  74. end
  75. end
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement