This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SlimeBOOS's profile picture

How to make a self updating program?

Started by SlimeBOOS, 12 February 2017 - 11:10 AM
SlimeBOOS #1
Posted 12 February 2017 - 12:10 PM
I need to find out how to make a self updating program because i dont wanna keep reupdating the pastebin links.
Bomb Bloke #2
Posted 12 February 2017 - 12:17 PM
Simply code the paste IDs into your script, along with an option for it to wipe and replace itself with a fresh copy of whatever's on the pastebin servers.

As a very simple example, I tend to write separate scripts alongside my larger ones which simply serve to download updates for me:

fs.delete("startup")
shell.run("pastebin get <somePasteId> startup")
os.reboot()

I can then just run my updater script, and hey presto, my computer restarts with the latest copy of my software on it. This obviously relies on me having a pastebin account so that I can upload fresh code updates to the same paste ID over and over.

If you're looking for anything more specific than this, then you may need to ask a more specific question.
Edited on 12 February 2017 - 11:19 AM