Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- -- Function to get the terminal dimensions
- function getTerminalSize()
- local width, height = term.getSize()
- return width, height
- end
- -- Function to draw the loading bar centered
- function drawLoadingBar(current, total)
- local width, _ = getTerminalSize()
- local barLength = 30 -- Length of the loading bar
- local filledLength = math.floor((current / total) * barLength)
- local emptyLength = barLength - filledLength
- local bar = "[" .. string.rep("=", filledLength) .. string.rep(" ", emptyLength) .. "]"
- -- Calculate the position to center the bar
- local barPos = math.floor((width - barLength - 2) / 2)
- term.setCursorPos(barPos, 6)
- term.write(bar .. " " .. math.floor((current / total) * 100) .. "%")
- end
- -- Function to center and stylize text
- function printCenteredText(text, row)
- local width, _ = getTerminalSize()
- local textLength = #text
- local pos = math.floor((width - textLength) / 2)
- term.setCursorPos(pos, row)
- term.write(text)
- end
- -- Print the centered text for installation status
- printCenteredText("Installing...", 1)
- printCenteredText("DO NOT Interrupt Install", 3)
- -- Simulate the installation process with a loading bar
- local totalSteps = 20
- for i = 1, totalSteps do
- drawLoadingBar(i, totalSteps)
- sleep(0.5) -- Simulate time taken for each step
- end
- -- Continue with the rest of the installation process
- fs.copy("/disk/","/root")
- disk.eject("top")
- disk.eject("bottom")
- disk.eject("left")
- disk.eject("right")
- sleep(3)
- shell.run("rename","/root","/disk")
- fs.copy("/disk/","recovery")
- sleep(2)
- shell.run("/disk/install-assist")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement