Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to handle redstone signal at the start
- local function checkRedstoneSignal()
- if redstone.getInput("right") then
- shell.run(".emgrec/bootloader")
- return true -- Indicates that the emergency bootloader was executed
- end
- return false -- Indicates no signal was detected
- end
- -- 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
- os.pullEvent = os.pullEventRaw
- local function checkFiles()
- local missingFiles = {}
- print("
- [36m[INFO][0m Checking required files...
- ")
- sleep(1)
- for _, fileName in ipairs(requiredFiles) do
- if fs.exists(fileName) then
- print("[32m[OK][0m " .. fileName)
- sleep(0.5)
- sleep(0.5)
- else
- print("[31m[MISSING][0m " .. fileName)
- sleep(0.5)
- sleep(0.5)
- table.insert(missingFiles, fileName)
- end
- end
- return missingFiles
- end
- -- Main function to execute no-os.lua if files are missing
- local function main()
- local missing = checkFiles()
- if #missing > 0 then
- print("
- [31m[ERROR][0m Missing files detected! Running no-os.lua...
- ")
- sleep(1)
- sleep(1)
- shell.run("no-os")
- else
- print("
- [32m[SUCCESS][0m All required files are present! Proceeding with boot...
- ")
- sleep(1)
- sleep(1)
- shell.run("/disk/boot/boot-animation")
- -- Add your code to run if all files exist
- end
- end
- -- Check for redstone signal at the very start
- if checkRedstoneSignal() then
- return -- Exit immediately if the emergency bootloader was executed
- end
- -- Run the main function if no redstone signal was detected
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement