Advertisement
DOGGYWOOF

Untitled

Jan 15th, 2025 (edited)
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. local w, h = term.getSize()
  2.  
  3. -- Function to center text horizontally
  4. local function centerText(y, text)
  5. local x = math.floor((w - #text) / 2)
  6. term.setCursorPos(x, y)
  7. term.write(text)
  8. end
  9.  
  10. -- Function to draw the ASCII art
  11. local dogImage = {
  12. " |\_/| ",
  13. " | @ @ Doggy OS ",
  14. " | <> _ ",
  15. " | _/\------____ ((| |))",
  16. " | `--' | ",
  17. " _____|_ ___| |___.' ",
  18. "/_/_____/____/_______| "
  19. }
  20.  
  21. local function drawASCIIArt(y)
  22. for i, line in ipairs(dogImage) do
  23. centerText(y + i - 1, line)
  24. end
  25. end
  26.  
  27. -- Function to draw a loading bar
  28. local function drawLoadingBar(y, percent)
  29. local barWidth = math.floor(w * 0.6)
  30. local barX = math.floor((w - barWidth) / 2)
  31. local completed = math.floor(barWidth * percent)
  32.  
  33. term.setCursorPos(barX, y)
  34. term.write("[")
  35. term.write(string.rep("=", completed))
  36. term.write(string.rep(" ", barWidth - completed))
  37. term.write("]")
  38. end
  39.  
  40. -- Function to simulate BIOS update
  41. local function biosUpdate()
  42. term.setBackgroundColor(colors.black)
  43. term.clear()
  44. term.setTextColor(colors.white)
  45.  
  46. local artHeight = #dogImage
  47. local artY = math.floor((h - artHeight) / 2) - 1
  48. drawASCIIArt(artY)
  49.  
  50. local loadingBarY = artY + artHeight + 2
  51. centerText(loadingBarY - 1, "Updating BIOS...")
  52.  
  53. for i = 1, 100 do
  54. drawLoadingBar(loadingBarY, i / 100)
  55. os.sleep(0.05) -- Simulate update progress
  56. end
  57.  
  58. os.sleep(1)
  59. centerText(loadingBarY + 2, "Update Complete! Restarting...")
  60. os.sleep(2)
  61. end
  62.  
  63. -- Function to check and perform firmware update
  64. local function checkFirmwareUpdate()
  65. if fs.exists(".FWupdate") then
  66. biosUpdate()
  67.  
  68. -- Download the new startup file
  69. local handle = http.get("https://pastebin.com/raw/S8BwCeEb")
  70. if handle then
  71. local data = handle.readAll()
  72. handle.close()
  73.  
  74. -- Save the new startup file
  75. local file = fs.open("startup", "w")
  76. file.write(data)
  77. file.close()
  78.  
  79. -- Remove the .FWupdate file
  80. fs.delete(".FWupdate")
  81. else
  82. error("Failed to download BIOS update.")
  83. end
  84.  
  85. -- Restart the system
  86. os.reboot()
  87. end
  88. end
  89.  
  90. -- Placeholder function for boot animation
  91. local function loadBootAnimation()
  92. term.setBackgroundColor(colors.black)
  93. term.clear()
  94.  
  95. term.setTextColor(colors.white)
  96. local artHeight = #dogImage
  97. local artY = math.floor((h - artHeight) / 2)
  98. drawASCIIArt(artY)
  99.  
  100. local spinnerX = math.floor(w / 2) - 3
  101. local spinnerY = artY + artHeight + 2
  102. centerText(spinnerY, "Booting...")
  103. os.sleep(2) -- Simulate boot delay
  104. end
  105.  
  106. -- Main function
  107. local function main()
  108. checkFirmwareUpdate()
  109.  
  110. term.setBackgroundColor(colors.black)
  111. term.clear()
  112. term.setTextColor(colors.white)
  113.  
  114. centerText(math.floor(h / 2), "Press DEL to show startup options")
  115. local timer = os.startTimer(2.5)
  116.  
  117. while true do
  118. local event, param = os.pullEvent()
  119. if event == "key" and param == keys.delete then
  120. term.setBackgroundColor(colors.black)
  121. term.clear()
  122. term.setTextColor(colors.white)
  123. centerText(math.floor(h / 2), "Loading startup menu...")
  124. os.sleep(2.5)
  125. shell.run("disk/boot/boot-options")
  126. return
  127. elseif event == "timer" and param == timer then
  128. loadBootAnimation()
  129. return
  130. end
  131. end
  132. end
  133.  
  134. -- Run the main function
  135. main()
  136.  
  137. -- Clear screen after shutdown
  138. term.setBackgroundColor(colors.black)
  139. term.clear()
  140.  
  141. -- Load lockscreen
  142. shell.run("disk/os/lock.lua")
  143.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement