SHARE
TWEET

KreOS 3.0 Skylark Installer

lxndio Apr 1st, 2015 (edited) 1,644 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ========================================
  2. -- The KreOS 3.0 Skylark Installer
  3. -- Written by kornichen
  4. -- Lastly modified on 10th April 2015
  5. -- Licensed under General Public License V3
  6. -- ========================================
  7.  
  8. local k1 = {{0,256,256,0,0,256,},{0,0,256,0,256,},{0,0,256,256,},{0,0,256,0,256,},{0,0,256,0,0,256,},{0,256,256,0,0,256,}}
  9. local k2 = {{0,128,128,0,0,128,},{0,0,128,0,128,},{0,0,128,128,},{0,0,128,0,128,},{0,0,128,0,0,128,},{0,128,128,0,0,128,}}
  10.  
  11. local w, h = term.getSize()
  12.  
  13. term.setTextColor(colors.lightGray)
  14. term.setBackgroundColor(colors.white)
  15. term.clear()
  16. term.setCursorPos((w / 2) - (string.len("KreOS 3.01 Skylark by kornichen") / 2), 2)
  17. term.write("KreOS 3.01 Skylark by kornichen")
  18.  
  19. local function setStatusText(statusText)
  20.         term.setTextColor(colors.black)
  21.         term.setBackgroundColor(colors.white)
  22.         term.setCursorPos((w / 2) - (string.len(statusText) / 2), h - 2)
  23.         term.clearLine()
  24.         term.write(statusText)
  25. end
  26.  
  27. function installKreOS()
  28.         setStatusText("Installing")
  29.         setStatusText("Getting installation list")
  30.         local installationList = textutils.unserialize(http.get("http://www.lxnd.me/kreos/installationList").readAll())
  31.         setStatusText("Downloading files")
  32.         local file = ""
  33.         for i = 1, #installationList do
  34.                 file = fs.open(installationList[i], "w")
  35.                 file.write(http.get("http://www.lxnd.me/kreos/files" .. installationList[i]).readAll())
  36.                 file.close()
  37.                 setStatusText("Downloaded " .. installationList[i] .. " (" .. i .. "/" .. #installationList .. ")")
  38.         end
  39.         local newestVersion = http.get("http://www.lxnd.me/kreos/version").readLine()
  40.         setStatusText("Completing installation")
  41.         file = ""
  42.         if fs.exists("/system/config/version") then
  43.                 fs.delete("/system/config/version")
  44.         end
  45.         file = fs.open("/system/config/version", "w")
  46.         file.writeLine(newestVersion)
  47.         file.close()
  48.         setStatusText("Installation complete. Rebooting")
  49.         os.reboot()
  50. end
  51.  
  52. function drawLogo()
  53.         while true do
  54.                 paintutils.drawImage(k1, (w / 2) - 2, (h / 2) - 2)
  55.                 sleep(0.075)
  56.                 term.setBackgroundColor(colors.white)
  57.                 for i = 1, 6 do
  58.                         term.setCursorPos(1, ((h / 2) - 3) + i)
  59.                         term.clearLine()
  60.                 end
  61.                 paintutils.drawImage(k2, (w / 2) - 2, (h / 2) - 2)
  62.                 sleep(0.5)
  63.                 term.setBackgroundColor(colors.white)
  64.                 for i = 1, 6 do
  65.                         term.setCursorPos(1, ((h / 2) - 3) + i)
  66.                         term.clearLine()
  67.                 end
  68.                 paintutils.drawImage(k1, (w / 2) - 2, (h / 2) - 2)
  69.                 sleep(0.075)
  70.                 term.setBackgroundColor(colors.white)
  71.                 for i = 1, 6 do
  72.                         term.setCursorPos(1, ((h / 2) - 3) + i)
  73.                         term.clearLine()
  74.                 end
  75.                 sleep(0.5)
  76.         end
  77. end
  78.  
  79. parallel.waitForAny(installKreOS, drawLogo)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top