Advertisement
ComputerMan123

New Autoupdater

Sep 22nd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. local nextFile = "/os"
  2. local files = {
  3. [1] = {
  4. "/System/Images/boot",
  5. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/Images/boot"
  6. },
  7. [2] = {
  8. "startup",
  9. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/startup"
  10. },
  11. [3] = {
  12. "/Programs/LuaIDE/program",
  13. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Programs/LuaIDE/program"
  14. },
  15. [4] = {
  16. "/Programs/Sketch/program",
  17. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Programs/Sketch/program"
  18. },
  19. [5] = {
  20. "/Desktop/LuaIDE",
  21. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Desktop/LuaIDE"
  22. },
  23. [6] = {
  24. "/Desktop/Sketch",
  25. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Desktop/Sketch"
  26. },
  27. [7] = {
  28. "/System/Images/desktop",
  29. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/Images/desktop"
  30. },
  31. [8] = {
  32. "/System/settings",
  33. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/settings"
  34. },
  35. [9] = {
  36. "/System/autoupdater",
  37. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/autoupdater"
  38. },
  39. [10] = {
  40. "/System/.version",
  41. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/.version"
  42. },
  43. [11] = {
  44. "/os",
  45. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/os"
  46. },
  47. [12] = {
  48. "/System/APIs/crasher",
  49. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/APIs/crasher"
  50. },
  51. [13] = {
  52. "/System/APIs/sha256",
  53. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/APIs/sha256"
  54. }
  55. }
  56.  
  57.  
  58.  
  59. remoteVersion = http.get("https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/.version")
  60.  
  61. local localVersion = fs.open("System/.version", "r")
  62. local rVersion = remoteVersion.readAll()
  63. local lVersion = localVersion.readAll()
  64.  
  65. localVersion.close()
  66.  
  67. if rVersion ~= lVersion then
  68. print("Downloading Update...")
  69. print("Your Verison: ", lVersion)
  70. print("New Version: ", rVersion)
  71. for k, v in pairs(files) do
  72. local currentFile = fs.open(v[1], "w")
  73.  
  74. local remoteFile = http.get(v[2])
  75.  
  76. if remoteFile ~= nil then
  77. currentFile.write(remoteFile.readAll())
  78. end
  79.  
  80. currentFile.close()
  81.  
  82. remoteFile.close()
  83. end
  84. end
  85.  
  86. local next = nextFile
  87. shell.run(next)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement