Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Will download programs from a file and set them up
- --This will download the pastebin URL listed in the tables and name from the first value
- --Will keep track of needed programs
- local downLst
- function downloadLst()
- print("Downloading program list...")
- if fs.exists("utils/list") then fs.delete("utils/list") end
- shell.run("pastebin","get","z94j1v3R", "utils/list")
- os.loadAPI("utils/list")
- downLst = list.getList()
- os.unloadAPI("utils/list")
- print("Download complete and new list acquired.")
- end
- function downloadLoop()
- print("Downloading program list...")
- for name, url in pairs(downLst) do
- print("Downloading "..name.."...")
- --Just in case I need to delete
- if fs.exists(name) then
- print("Deleting old "..name.."...")
- fs.delete(name)
- end
- shell.run("pastebin", "get", url, name)
- print(name.." complete!")
- end
- end
- function checkVersion()
- --Downloads list file and checks if programs need updating
- if not fs.exists("utils/list") then
- downloadLst()
- downloadLoop()
- end
- os.loadAPI("utils/list")
- local oldVersion = list.getVersion()
- os.unloadAPI("utils/list")
- downloadLst()
- os.loadAPI("utils/list")
- --If they don't match then a change has been made
- if oldVersion ~= list.getVersion() then
- downloadLoop()
- end
- os.unloadAPI("utils/list")
- end
- if checkVersion() then
- downloadLst()
- downloadLoop()
- print("Update finished!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement