Advertisement
BruceWplays

Updater V2 prog

Sep 10th, 2022
1,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. updateloop = 0
  2. fupdateargs = {...}
  3. while true do
  4.     if fs.isDir(udloc) == false then
  5.         fs.makeDir(udloc)
  6.     end
  7.     os.run({}, "cd", udloc)
  8.  
  9.  
  10.     if fs.exists(updateprogram.."new") then
  11.         shell.run("delete",updateprogram.."new")
  12.     end
  13.     shell.run("pastebin","get",pastelink,updateprogram.."new")
  14.     if fs.exists(updateprogram.."new") then
  15.         if fs.exists(updateprogram.."old") then
  16.             shell.run("delete",updateprogram.."old")
  17.         end
  18.         if fs.exists("Farm") then
  19.             shell.run("rename",updateprogram,updateprogram.."old")
  20.         end
  21.         shell.run("rename",updateprogram.."new",updateprogram)
  22.         if fs.exists(updateprogram) then
  23.             break
  24.         end
  25.     end
  26.     if fs.exists(updateprogram) then
  27.         if updateloop > 20 then
  28.             break
  29.         end
  30.     end
  31.     if fs.exists(updateprogram.."old") then
  32.         if updateloop > 30 then
  33.             shell.run("rename",updateprogram.."old",updateprogram)
  34.             if fs.exists(updateprogram) then
  35.                 break
  36.             end
  37.         end
  38.     end
  39.     updateloop = updateloop + 1
  40. end
  41. local _, countsl = string.gsub(udloc,"/","")
  42. countsl = countsl + 1
  43.  
  44. if startupls ~= "none" or startupls ~= nil then
  45.     local stu = fs.open("startup.lua", "w")
  46.     stu.write(startupls)
  47.     stu.close()
  48. end
  49. if updatefunargs ~= nil or updatefunargs ~= "none" then
  50.     shell.run(updateprogram .. "," .. unpack(updateargs))
  51. else
  52.     shell.run(updateprogram)
  53. end
  54. for i=1,countsl do
  55.     shell.run("cd", "..")
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement