Advertisement
DOGGYWOOF

Doggy OS pocket Recovery Access

Apr 5th, 2024 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. -- Function to create the Recovery.cfg file
  2. local function createRecoveryFile()
  3. local file = fs.open("Recovery.cfg", "w")
  4. file.close()
  5. -- Show message about connecting device to Doggy OS device or Device Running Dogdroid Recovery
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. print("Recovery.cfg file created.")
  9. print("Connect your device to a Doggy OS device")
  10. print("or a device running Dogdroid Recovery.")
  11. end
  12.  
  13. -- Function to run /disk/boot/check-recovery
  14. local function runCheckRecovery()
  15. shell.run("/disk/boot/check-recovery")
  16. end
  17.  
  18. -- Main function
  19. local function main()
  20. -- Variable to track if enter is pressed
  21. local enterPressed = false
  22.  
  23. -- Event loop to check for key press
  24. parallel.waitForAny(
  25. function()
  26. while true do
  27. local event, key = os.pullEvent("key")
  28. if key == keys.enter then
  29. enterPressed = true
  30. break
  31. end
  32. end
  33. end,
  34. function()
  35. os.sleep(2)
  36. if not enterPressed then
  37. runCheckRecovery()
  38. end
  39. end
  40. )
  41.  
  42. -- If enter is pressed, create Recovery.cfg file
  43. if enterPressed then
  44. createRecoveryFile()
  45. end
  46. end
  47.  
  48. -- Run the main function
  49. main()
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement