FFGFlash

startup

Sep 14th, 2021 (edited)
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. local t,c,b,u,m = "///nekOS///", "77800000877", "f", false, {}
  4. if term.isColor() then c,b = "edb00000bde", "7" end
  5.  
  6. shell.run(".api")
  7. shell.run(".colors")
  8.  
  9. if fs.exists("/.manifest") then _G.Manifest = data.load("/.manifest") end
  10.  
  11. term.setTextColor(_G.TextColor)
  12. term.setBackgroundColor(_G.BackgroundColor)
  13. term.clear()
  14. term.setCursorPos(1,1)
  15.  
  16. shell.run(".network")
  17. shell.run(".app", "setup")
  18.  
  19. term.setTextColor(_G.TextColor)
  20. term.setBackgroundColor(_G.BackgroundColor)
  21. term.clear()
  22. term.setCursorPos(1,1)
  23. local w,h = term.getSize()
  24.  
  25. term.setCursorPos(math.floor((w - string.len(t)) / 2), math.floor(h / 2))
  26. for i=1,#t,1 do
  27.   term.blit(string.sub(t,i,i),string.sub(c,i,i),b)
  28.   sleep(1/5)
  29. end
  30.  
  31. local current,total = 0,0
  32. local function progressBar(message)
  33.   local perc = current / total
  34.   local ii = math.floor(perc * w)
  35.   term.setCursorPos(1,h-1)
  36.   term.clearLine()
  37.   term.write(message)
  38.   local perstr = ""..(math.floor(perc * 1000) / 10).."%"
  39.   term.setCursorPos(w-string.len(perstr)+1,h-1)
  40.   term.write(perstr)
  41.   term.setCursorPos(1,h)
  42.   term.clearLine()
  43.   for i=1,ii,1 do term.blit("#","8",b) end
  44. end
  45.  
  46. local m = _G.Manifest
  47. local success,err = pastebin.get(m.Code, ".manifest", true)
  48. if not success then print(err) end
  49. local nm = data.load("/.manifest")
  50. for k,v in pairs(nm.Files) do total = total + 1 end
  51. for k,v in pairs(nm.Files) do
  52.   progressBar("Validating "..k.."...")
  53.   if not m.Files[k] or m.Files[k].Version ~= v.Version then
  54.     progressBar("Downloading "..k.."...")
  55.     local success,err = pastebin.get(v.Code, k, true)
  56.     if not success then print(err) end
  57.     u = true
  58.   end
  59.   sleep(1/total)
  60.   m.Files[k] = nil
  61.   current = current + 1
  62. end
  63. current,total = 0,0
  64. for k,v in pairs(m.Files) do total = total + 1 end
  65. for k,v in pairs(m.Files) do
  66.   progressBar("Removing "..k.."...")
  67.   fs.delete(k)
  68.   current = current + 1
  69.   u = true
  70.   sleep(1/total)
  71. end
  72. if u then os.reboot() end
  73. _G.Manifest = nm
  74.  
  75. shell.run(".app", "boot")
  76.  
  77. term.clear()
  78. term.setCursorPos(1,1)
  79.  
  80. _G.User = data.load(".user")
  81. if not _G.User.Username then shell.run(".setup")
  82. else shell.run((_G.User.Password == "" or _G.User.Password == md5.calc("")) and ".menu" or ".login") end
Add Comment
Please, Sign In to add comment