Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of required files
- local requiredFiles = {
- "/disk/bootloader/VA11-ILLA.lua",
- "/disk/os/home.lua",
- "/disk/os/lock.lua",
- "/disk/boot/boot-animation",
- "/disk/error/BSOD.lua",
- -- Add more file names as needed
- }
- -- Function to check if all required files exist
- local function checkFiles()
- local missingFiles = {}
- for _, fileName in ipairs(requiredFiles) do
- if not fs.exists(fileName) then
- table.insert(missingFiles, fileName)
- end
- end
- return missingFiles
- end
- -- Function to display a boot UI
- local function displayBootScreen(stage)
- term.clear()
- term.setCursorPos(1, 1)
- -- Draw a border
- local width, height = term.getSize()
- for x = 1, width do
- term.setCursorPos(x, 1)
- term.write("-")
- term.setCursorPos(x, height)
- term.write("-")
- end
- for y = 2, height - 1 do
- term.setCursorPos(1, y)
- term.write("|")
- term.setCursorPos(width, y)
- term.write("|")
- end
- -- Centered title
- term.setCursorPos((width - #("VA11-ILLA Bootloader")) // 2, 2)
- term.write("VA11-ILLA Bootloader")
- -- Display boot stage
- term.setCursorPos((width - #("Status: " .. stage)) // 2, height // 2)
- term.write("Status: " .. stage)
- -- Footer
- term.setCursorPos((width - #("© Doggy OS")) // 2, height - 1)
- term.write("© Doggy OS")
- end
- -- Function to simulate a loading bar
- local function loadingBar()
- local width, height = term.getSize()
- local barWidth = math.floor(width * 0.6)
- local barStartX = (width - barWidth) // 2
- local barY = height // 2 + 2
- term.setCursorPos(barStartX, barY)
- term.write("[")
- term.setCursorPos(barStartX + barWidth + 1, barY)
- term.write("]")
- for i = 1, barWidth do
- sleep(0.05)
- term.setCursorPos(barStartX + i, barY)
- term.write("=")
- end
- end
- -- Main function to execute no-os.lua if files are missing
- local function main()
- displayBootScreen("Initializing")
- sleep(1)
- local missing = checkFiles()
- if #missing > 0 then
- displayBootScreen("Missing Files Detected")
- sleep(1)
- -- Show missing files
- term.clear()
- term.setCursorPos(1, 1)
- print("The following files are missing:")
- for _, fileName in ipairs(missing) do
- print("- " .. fileName)
- end
- sleep(3)
- -- Execute no-os.lua
- shell.run("no-os")
- else
- displayBootScreen("All Files Verified")
- loadingBar()
- -- Continue with boot process
- term.clear()
- term.setCursorPos(1, 1)
- print("VA11-ILLA Bootloader")
- print("Loading...")
- sleep(2)
- shell.run("/disk/boot/check-recovery")
- -- Add your code to run if all files exist
- end
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement