Z1maV1

init

May 14th, 2022 (edited)
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.11 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. __version = "1.2.1"
  4.  
  5. local args = {...}
  6.  
  7. local function has_value (tab, val)
  8.     for index, value in ipairs(tab) do
  9.         if value == val then
  10.             return true
  11.         end
  12.     end
  13.  
  14.     return false
  15. end
  16.  
  17. shell.setDir("/")
  18. shell.setPath(shell.path()..":/bin:/usr/bin")
  19.  
  20. fs.delete("/tmp")
  21. fs.makeDir("/tmp")
  22.  
  23. if args == nil or has_value(args, "--suppress-updates") == false then
  24.  
  25.     write("Checking for ")
  26.     term.setTextColor(colors.cyan)
  27.     write("Diamond OS ")
  28.     term.setTextColor(colors.white)
  29.     print("updates")
  30.  
  31.     shell.run("pastebin get C4AXnTiu /tmp/versionInfo")
  32.    
  33.     if fs.exists("/tmp/versionInfo") then
  34.         local file = io.open("/tmp/versionInfo", "r")
  35.         local version = file:read()
  36.         file:close()
  37.         fs.delete("/tmp/versionInfo")
  38.        
  39.         if version ~= __version then
  40.             term.setTextColor(colors.cyan)
  41.             write("Diamond OS " .. version)
  42.             term.setTextColor(colors.white)
  43.             print(" is available!")
  44.             print("downloading updater at '/tmp/update'!")
  45.             print("copy all files from update folder to floppy disk")
  46.             if fs.exists("/tmp/update") then
  47.                 shell.run("delete /tmp/update")
  48.             end
  49.             sleep(2)
  50.             shell.run("mkdir /tmp/update/")
  51.             shell.run("mkdir /tmp/update/bios/")
  52.             shell.run("mkdir /tmp/update/diamondOS/")
  53.             shell.run("mkdir /tmp/update/diamondOS/os/")
  54.             shell.run("mkdir /tmp/update/diamondOS/os/boot/")
  55.             shell.run("mkdir /tmp/update/diamondOS/os/bin/")
  56.             shell.run("mkdir /tmp/update/diamondOS/os/etc/")
  57.             shell.run("mkdir /tmp/update/diamondOS/os/home/")
  58.             shell.run("mkdir /tmp/update/diamondOS/os/lib/")
  59.             shell.run("mkdir /tmp/update/temp/")
  60.             shell.run("pastebin get xy5Xbu8d /tmp/update/startup")
  61.             shell.run("pastebin get 5Zbtsqcp /tmp/update/bios/startup.bios")
  62.             shell.run("pastebin get dpELuj8e /tmp/update/diamondOS/back.lua")
  63.             shell.run("pastebin get eggHuRDr /tmp/update/diamondOS/os/usr/bin/sendFiles")
  64.             shell.run("pastebin get XVFay6kL /tmp/update/diamondOS/os/usr/bin/getFiles")
  65.             shell.run("pastebin get n0TYWPg0 /tmp/update/diamondOS/os/usr/bin/browser")
  66.             shell.run("pastebin get 5Zbtsqcp /tmp/update/diamondOS/os/boot/startup")
  67.             shell.run("pastebin get WsCzE6yg /tmp/update/diamondOS/os/boot/recovery.lua")
  68.             shell.run("pastebin get Ss3Xm8Gs /tmp/update/diamondOS/os/boot/boot.lua")
  69.             shell.run("pastebin get PSp7HphJ /tmp/update/diamondOS/os/boot/craftbootloader.lua")
  70.             shell.run("pastebin get MKAUF1aB /tmp/update/diamondOS/os/boot/init")
  71.             shell.run("pastebin get nH47yXMJ /tmp/update/diamondOS/os/bin/.command")
  72.             shell.run("pastebin get u5nCuSmc /tmp/update/diamondOS/os/bin/.programs")
  73.             shell.run("pastebin get T4hMDcjM /tmp/update/diamondOS/os/bin/.shutdown")
  74.             shell.run("pastebin get Z2TD7KJD /tmp/update/diamondOS/os/bin/.sleep")
  75.             shell.run("pastebin get w4XWgvcZ /tmp/update/diamondOS/os/bin/install")
  76.             shell.run("pastebin get dvFUiJ7k /tmp/update/diamondOS/os/bin/.uninstall")
  77.             shell.run("pastebin get zdSEmGNM /tmp/update/diamondOS/os/bin/.UninstallDialog")
  78.             shell.run("pastebin get NtKBPusE /tmp/update/diamondOS/os/bin/BSOD")
  79.             shell.run("pastebin get tdiZwXAi /tmp/update/diamondOS/os/bin/main")
  80.             shell.run("pastebin get 0iexJb9q /tmp/update/diamondOS/os/bin/ncBSOD")
  81.             shell.run("pastebin get wXKUuzNx /tmp/update/diamondOS/os/bin/.about")
  82.             shell.run("pastebin get GF9tLvZ6 /tmp/update/diamondOS/os/bin/capule.lua")            
  83.             shell.run("pastebin get v5XWn99E /tmp/update/diamondOS/os/lib/config.lua")
  84.             shell.run("pastebin get u5BjvyFe /tmp/update/diamondOS/os/lib/exceptions.lua")
  85.             shell.run("pastebin get iLY3Jeuc /tmp/update/diamondOS/os/lib/express.lua")
  86.             shell.run("pastebin get PNEh7K7s /tmp/update/diamondOS/os/lib/string.lua")
  87.             shell.run("pastebin get MzrE4pWW /tmp/update/diamondOS/os/lib/url.lua")
  88.             shell.run("pastebin get kEqLGkrW /tmp/update/diamondOS/os/lib/uuid.lua")
  89.             shell.run("pastebin get ZswRgdCB /tmp/update/diamondOS/os/lib/cache.lua")
  90.             shell.run("pastebin get bmE3aTzv /tmp/update/diamondOS/os/lib/crypto/sha2.lua")
  91.             shell.run("pastebin get swWJdc7X /tmp/update/diamondOS/os/lib/args.lua")
  92.             shell.run("pastebin get UCx4aiR0 /tmp/update/diamondOS/os/lib/binary.lua")
  93.             shell.run("pastebin get QyJL90XJ /tmp/update/diamondOS/os/lib/cache.lua")
  94.             shell.run("pastebin get abFf6TPB /tmp/update/diamondOS/os/lib/logger.lua")
  95.             shell.run("pastebin get TQxHVC6D /tmp/update/diamondOS/os/lib/print-utils.lua")
  96.             shell.run("pastebin get KUjYeHfm /tmp/update/diamondOS/os/lib/stringbuilder.lua")
  97.            
  98.             shell.run("wget https://github.com/SiliconSloth/CryptoNet/raw/master/cryptoNet.lua /tmp/update/diamondOS/os/lib/crypto/net/cryptoNet.lua")
  99.             shell.run("wget https://gist.github.com/1lann/6604c8d3d8e5fdad0832/raw/9dee2620c504b44a1ea5c8882c0395110fcc38d7/rsa-crypt.lua /tmp/update/diamondOS/os/lib/crypto/rsa.lua")
  100.             shell.run("wget https://gist.github.com/1lann/c9d4d2e7c1f825cad36b/raw/d18b466be8a88eca32fa58e023270640cb57678d/rsa-keygen.lua /tmp/update/diamondOS/os/lib/crypto/rsa_gen.lua")
  101.             shell.run("pastebin get 8VTiuDBx /tmp/update/temp/cancel.lua")
  102.             shell.run("pastebin get pRKZLKge /tmp/update/temp/install.lua")
  103.             shell.run("pastebin get c80ZXcqT /tmp/update/temp/.deletetemp.lua")
  104.             print("Opening terminal...")
  105.             error()
  106.         else
  107.             term.setTextColor(colors.red)
  108.             print("No update available")
  109.             term.setTextColor(colors.white)
  110.         end
  111.     else
  112.         shell.run("/bin/BSOD", "\"[DO:0001] No or corrupted file\"")
  113.     end
  114. else
  115.     print("Running with suppress updates option!\nSkipping...")
  116. end
  117. term.clear()
  118. term.setCursorPos(1,1)
  119. shell.run("/bin/main")
  120.  
Advertisement
Add Comment
Please, Sign In to add comment