Advertisement
DOGGYWOOF

Untitled

Jul 24th, 2024 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. term.clear()
  2.  
  3. -- Function to get the terminal dimensions
  4. function getTerminalSize()
  5. local width, height = term.getSize()
  6. return width, height
  7. end
  8.  
  9. -- Function to draw the loading bar centered
  10. function drawLoadingBar(current, total)
  11. local width, _ = getTerminalSize()
  12. local barLength = 30 -- Length of the loading bar
  13. local filledLength = math.floor((current / total) * barLength)
  14. local emptyLength = barLength - filledLength
  15. local bar = "[" .. string.rep("=", filledLength) .. string.rep(" ", emptyLength) .. "]"
  16.  
  17. -- Calculate the position to center the bar
  18. local barPos = math.floor((width - barLength - 2) / 2)
  19.  
  20. term.setCursorPos(barPos, 6)
  21. term.write(bar .. " " .. math.floor((current / total) * 100) .. "%")
  22. end
  23.  
  24. -- Function to center and stylize text
  25. function printCenteredText(text, row)
  26. local width, _ = getTerminalSize()
  27. local textLength = #text
  28. local pos = math.floor((width - textLength) / 2)
  29. term.setCursorPos(pos, row)
  30. term.write(text)
  31. end
  32.  
  33. -- Print the centered text for installation status
  34. printCenteredText("Installing...", 1)
  35. printCenteredText("DO NOT Interrupt Install", 3)
  36.  
  37. -- Simulate the installation process with a loading bar
  38. local totalSteps = 20
  39. for i = 1, totalSteps do
  40. drawLoadingBar(i, totalSteps)
  41. sleep(0.5) -- Simulate time taken for each step
  42. end
  43.  
  44. -- Continue with the rest of the installation process
  45. fs.copy("/disk/","/root")
  46. disk.eject("top")
  47. disk.eject("bottom")
  48. disk.eject("left")
  49. disk.eject("right")
  50. sleep(3)
  51. shell.run("rename","/root","/disk")
  52. fs.copy("/disk/","recovery")
  53. sleep(2)
  54. shell.run("/disk/install-assist")
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement