robathome

RoboMiner_updateController

Oct 18th, 2025
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. -- update_controller.lua
  2. -- Fetch controller_startup.lua from Pastebin and reboot.
  3.  
  4. local START_DIR = "/startup"
  5. local FILE_NAME = "controller_startup.lua"
  6. local PASTEBIN_CODE = "RdSSwwX4"
  7.  
  8. local function run(...)
  9. local ok, err = shell.run(...)
  10. if not ok then error("cmd failed: "..table.concat({...}," ")..": "..tostring(err)) end
  11. end
  12.  
  13. -- Ensure /startup exists
  14. if not fs.isDir(START_DIR) then fs.makeDir(START_DIR) end
  15. shell.setDir(START_DIR)
  16.  
  17. -- Remove old file
  18. if fs.exists(FILE_NAME) then fs.delete(FILE_NAME) end
  19.  
  20. -- Download new file
  21. run("pastebin","get",PASTEBIN_CODE,FILE_NAME)
  22.  
  23. -- Reboot
  24. print("Update complete. Rebooting...")
  25. sleep(0.5)
  26. os.reboot()
  27.  
Add Comment
Please, Sign In to add comment