Advertisement
DOGGYWOOF

Untitled

Oct 1st, 2024 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. -- Function to check for F1 and F8 key presses
  2. local function checkKeys()
  3. local timer = os.startTimer(1) -- Start a timer for 1 second
  4.  
  5. while true do
  6. local event, key = os.pullEvent()
  7.  
  8. -- If Recovery.sys exists, show recovery mode and do nothing else
  9. if fs.exists("Recovery.sys") then
  10. print("Doggy OS Recovery Mode")
  11. return
  12. end
  13.  
  14. -- Check if F1 is pressed
  15. if event == "key" and key == keys.f1 then
  16. -- Cancel the timer
  17. os.cancel(timer)
  18.  
  19. -- Wait for 1 second before displaying recovery mode
  20. sleep(1)
  21. if not fs.exists("Recovery.sys") then
  22. -- Create Recovery.sys if it doesn't exist
  23. local file = fs.open("Recovery.sys", "w")
  24. file.write("Recovery mode activated.")
  25. file.close()
  26. print("Doggy OS Recovery Mode")
  27. end
  28. return
  29. end
  30.  
  31. -- Check if F8 is pressed
  32. if event == "key" and key == keys.f8 then
  33. if fs.exists("Recovery.sys") then
  34. -- Delete Recovery.sys and reboot
  35. fs.delete("Recovery.sys")
  36. print("Recovery.sys deleted. Rebooting...")
  37. sleep(2) -- Sleep for 2 seconds before reboot
  38. os.reboot()
  39. else
  40. print("Recovery.sys does not exist.")
  41. end
  42. end
  43.  
  44. -- Check if timer event is triggered
  45. if event == "timer" and key == timer then
  46. -- Run the boot animation script if no key was pressed in 1 second
  47. shell.run("/disk/boot/boot-animation") -- Removed the .lua extension
  48. return
  49. end
  50. end
  51. end
  52.  
  53. -- Check for recovery mode at startup
  54. if fs.exists("Recovery.sys") then
  55. print("Doggy OS Recovery Mode")
  56. else
  57. -- Start listening for key presses
  58. checkKeys()
  59. end
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement