Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- settings.load(".settings")
- local ClientVersion = settings.get("ClientVersion")
- local NetVersion = "2.0.0"
- local AllowUpdate = true
- local ReplaceItems = {}
- local AddItems = {}
- local AddClientApps = {}
- local RemoveItems = {}
- local Run = {"BCCRGYMR"}
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function Prompt()
- print("Updates found")
- print("do you wish to update system?")
- print("current version = ",ClientVersion)
- print("latest version = ",NetVersion)
- print("updates System to latest OS")
- print("y/n")
- local event
- repeat
- event = {os.pullEvent("key")}
- until event[2] == keys.y or event[2] == keys.n
- if event[2] == keys.n then
- os.sleep(1)
- elseif event[2] == keys.y then
- UpdateSystemStart()
- end
- end
- function UpdateSystemStart()
- Clear()
- print("Starting Update..")
- print("deleting Items")
- for i = 1, #RemoveItems do
- fs.delete(RemoveItems[i])
- print(RemoveItems[i]," removed")
- end
- print("Replacing Items")
- for i = 1, #ReplaceItems do
- fs.delete(ReplaceItems[i][1])
- shell.run( settings.get("osPaster"),"get",ReplaceItems[i][2],ReplaceItems[i][1])
- print(ReplaceItems[i][1]," replaced")
- end
- print("Installing New Items")
- for i = 1, #AddItems do
- if fs.exists(AddItems[i][1]) then
- else
- shell.run( settings.get("osPaster"),"get",AddItems[i][2],AddItems[i][1])
- print(AddItems[i][1]," installed")
- end
- end
- print("Base Update Complete")
- print("Downloading New Apps")
- for i = 1, #AddClientApps do
- if fs.exists(AddClientApps[i][2]) then
- else
- shell.run( "os/System/Programs/InstallManager", AddClientApps[i][2], AddClientApps[i][3],"Client", AddClientApps[i][1],"blank")
- end
- end
- for i = 1, #Run do
- shell.run(settings.get("osPaster"),"run",Run[i])
- end
- print("Installing Files")
- print("UpdateComplete")
- UpdateSystemEnd()
- end
- function UpdateSystemEnd()
- settings.set("ClientVersion",NetVersion)
- settings.save(".settings")
- print("Rebooting..")
- os.sleep(2)
- shell.run(settings.get("PowerManager"),"restart")
- end
- if ClientVersion ~= NetVersion and AllowUpdate == true then
- Prompt()
- else
- end
Add Comment
Please, Sign In to add comment