Simlor_GER

SimSoft 4 - SystemUpdate

Jul 6th, 2016 (edited)
1,514
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Copyright Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/) - Alle Rechte an diesen Programm sind Simlor vorbehalten.
  2.  
  3.  
  4. BC(256)
  5. Clear()
  6.  
  7. SimSoftBalken("SimSoft 4 - OS-Update", 21)
  8.  
  9. TC(1)
  10. BC(256)
  11. CP(4,5)
  12. print("Update System")
  13.  
  14. TC(128)
  15.  
  16. --Version des eigenen OS
  17. CP(2,7)
  18.  
  19. VerSpr()
  20.  
  21. print("Clint os version: "..SS2V)
  22.  
  23. --Update Datei wird geladen
  24. CP(2,8)
  25. print("Load Update Details")
  26.  
  27. local cacheBuster = ("%x"):format(math.random(0, 2 ^ 30))
  28. local datei = http.get("https://pastebin.com/raw/5dPkiCxH".. "?cb=" .. cacheBuster)
  29. datei = datei.readAll()
  30.  
  31. local file = fs.open("SimSoft/Data/UpdateCheck/S","w")
  32. file.writeLine(datei)
  33. file.close()
  34.  
  35. CP(2,9)
  36. TC(128)
  37.  
  38. file = fs.open("SimSoft/Data/UpdateCheck/S","r")
  39. local fileData = {}
  40. local line = file.readLine()
  41. repeat
  42. table.insert(fileData,line)
  43. line = file.readLine()
  44. until line == nil
  45. file.close()
  46.  
  47. v = fileData[1]
  48.  
  49. if v == SS2V then
  50. print("The latest version is already")
  51. CP(2,10)
  52. print("installed")
  53. TC(1)
  54. CP(2,11)
  55. print("Please wait...")
  56. sleep(4)
  57. fs.delete("SimSoft/Data/UpdateCheck/S")
  58. print(" System reboot...")
  59. sleep(0.2)
  60. os.reboot()
  61. else
  62. print("Update available...")
  63. sleep(2)
  64. BC(32768)
  65. TC(1)
  66. Clear()
  67. print("SimSoft Update BOX")
  68.  
  69. a = 1
  70.  
  71. while true do
  72. a = (a+3)
  73. v = fileData[a]
  74.  
  75. if v == SS2V then
  76. break
  77. end
  78. end
  79.  
  80. a = (a+1)
  81. l = fileData[a]
  82.  
  83. local cacheBuster = ("%x"):format(math.random(0, 2 ^ 30))
  84. local datei = http.get("https://pastebin.com/raw/" .. textutils.urlEncode(l) .. "?cb=" .. cacheBuster)
  85. datei = datei.readAll()
  86.  
  87. local file = fs.open("SimSoft/Data/UpdateCheck/version","w")
  88. file.writeLine(datei)
  89. file.close()
  90.  
  91. shell.run("SimSoft/Data/UpdateCheck/version")
  92.  
  93. fs.delete("SimSoft/Data/UpdateCheck/S")
  94. print("System reboot...")
  95. sleep(0.2)
  96. os.reboot()
  97. end
  98.  
  99. --End
RAW Paste Data