Advertisement
DOGGYWOOF

Check Bootloader

Jul 24th, 2024 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. -- List of keywords to check for in the startup scripts
  2. local requiredKeywords = {
  3. "local requiredFiles = {",
  4. "/disk/bootloader/VA11-ILLA.lua",
  5. "/disk/os/home.lua",
  6. "/disk/os/lock.lua",
  7. "/disk/boot/boot-animation",
  8. "/disk/error/BSOD.lua",
  9. "os.pullEvent = os.pullEventRaw",
  10. "local function checkFiles()",
  11. "local function main()",
  12. "shell.run(\"no-os\")",
  13. "shell.run(\"/disk/boot/start-check.lua\")"
  14. -- Add more keywords as needed
  15. }
  16.  
  17. -- Function to read a file's content
  18. local function readFile(path)
  19. if not fs.exists(path) then
  20. return nil
  21. end
  22.  
  23. local file = fs.open(path, "r")
  24. local content = file.readAll()
  25. file.close()
  26. return content
  27. end
  28.  
  29. -- Function to check for the presence of keywords in a script
  30. local function checkForKeywords(content, keywords)
  31. if not content then
  32. return false
  33. end
  34.  
  35. for _, keyword in ipairs(keywords) do
  36. if not string.find(content, keyword, 1, true) then
  37. return false
  38. end
  39. end
  40.  
  41. return true
  42. end
  43.  
  44. -- Main function to compare the contents of `startup` and `startup.lua`
  45. local function compareStartupFiles()
  46. local startupContent = readFile("/startup")
  47. local startupLuaContent = readFile("/startup.lua")
  48.  
  49. if checkForKeywords(startupContent, requiredKeywords) or checkForKeywords(startupLuaContent, requiredKeywords) then
  50. print("Success: The startup script contains all required keywords.")
  51. else
  52. print("Error: The startup script does not contain all required keywords.")
  53. end
  54. end
  55.  
  56. -- Run the comparison function
  57. compareStartupFiles()
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement