Advertisement
DOGGYWOOF

Untitled

Jan 14th, 2025 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. -- Doggy OS UEFI
  2.  
  3. -- Function to draw a border
  4. local function drawBorder()
  5. term.clear()
  6. local w, h = term.getSize()
  7. for y = 1, h do
  8. term.setCursorPos(1, y)
  9. term.write("|")
  10. term.setCursorPos(w, y)
  11. term.write("|")
  12. end
  13. for x = 1, w do
  14. term.setCursorPos(x, 1)
  15. term.write("-")
  16. term.setCursorPos(x, h)
  17. term.write("-")
  18. end
  19. term.setCursorPos(1, 1)
  20. term.write("+")
  21. term.setCursorPos(w, 1)
  22. term.write("+")
  23. term.setCursorPos(1, h)
  24. term.write("+")
  25. term.setCursorPos(w, h)
  26. term.write("+")
  27. end
  28.  
  29. -- Function to center text on the screen
  30. local function centerText(text, y)
  31. local w, _ = term.getSize()
  32. local x = math.floor((w - #text) / 2) + 1
  33. term.setCursorPos(x, y)
  34. term.write(text)
  35. end
  36.  
  37. -- Function to show the UEFI message
  38. local function showUEFIMessage(message)
  39. drawBorder()
  40. local _, h = term.getSize()
  41. centerText("Doggy OS UEFI", math.floor(h / 2) - 1)
  42. centerText(message, math.floor(h / 2) + 1)
  43. end
  44.  
  45. -- Function to load the boot animation
  46. local function loadBootAnimation()
  47. if fs.exists("/disk/boot/boot-animation") then
  48. shell.run("/disk/boot/boot-animation")
  49. else
  50. print("Boot animation not found!")
  51. end
  52. end
  53.  
  54. -- Function to load the boot options
  55. local function loadBootOptions()
  56. if fs.exists("/disk/boot/boot-options") then
  57. shell.run("/disk/boot/boot-options")
  58. else
  59. print("Boot options not found!")
  60. end
  61. end
  62.  
  63. -- Main function to handle UEFI message and timeout
  64. local function main()
  65. showUEFIMessage("Press DEL to show startup options")
  66. local timer = os.startTimer(2.5) -- Set a timer for 2 seconds
  67.  
  68. while true do
  69. local event, param = os.pullEvent()
  70. if event == "key" and param == keys.delete then
  71. -- Update message and load boot options
  72. showUEFIMessage("Loading startup menu...")
  73. sleep(2.5) -- Pause for a bit longer to display the message
  74. loadBootOptions()
  75. return
  76. elseif event == "timer" and param == timer then
  77. -- Timer expired, load boot animation
  78. loadBootAnimation()
  79. return
  80. end
  81. end
  82. end
  83.  
  84. -- Start the main function
  85. main()
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement