Advertisement
Ungarscool1

Installer OS server

Jun 22nd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.53 KB | None | 0 0
  1. --[[ Local Variables ]]--
  2.     -- Root Directories & Extentions --
  3.     local Root = ".Network/"
  4.     local iRoot = ".Network/Info/"
  5.      
  6.     --[[ Functions ]]--
  7.     -- Misc --
  8.     function clear()
  9.             term.clear()
  10.             term.setCursorPos(1,1)
  11.     end
  12.      
  13.     function Reset()
  14.             clear()
  15.      term.setTextColor(colors.red)
  16.             write("Ungarscool1 OS server")
  17.      term.setTextColor(colors.yellow)
  18.             printTR("- Installer -")
  19.      term.setTextColor(colors.white)
  20.             printTM("[ Computercraft \nEdition ]")
  21.             w, h = term.getSize()
  22.             print(string.rep("-", w)) write("\n")
  23.     end
  24.      
  25.     function printTR( text )
  26.             w, h = term.getSize()
  27.             term.setCursorPos(w - #text, 1)
  28.             write(text)
  29.     end
  30.      
  31.     function printTM( text )
  32.             local w, h = term.getSize()
  33.             term.setCursorPos((w - #text) / 2, 1)
  34.             write(text)
  35.     end
  36.      
  37.     function printC( text )
  38.             local x, y = term.getSize()
  39.             term.setCursorPos(( x - string.len(text)) / 2, y / 2)
  40.             write( text )
  41.     end
  42.      
  43.     -- Interface --
  44.     Reset()
  45.     term.setTextColor(colors.yellow)
  46.     print("Setting Up Directories...")
  47.     os.sleep(1)
  48.     fs.makeDir(Root)
  49.     fs.makeDir(iRoot)
  50.     print("Getting Needed Files...")
  51.     Network = http.get("https://www.dropbox.com/s/jb45w1ygprw53ku/ungarscool1os.lua?dl=1")
  52.     Startup = http.get("https://www.dropbox.com/s/5gnh5sc5tupsh91/Startup?dl=1")
  53.     Update = http.get("https://www.dropbox.com/s/zoczv0xvnc7wolb/Update.lua?dl=1")
  54.     store = http.get("https://www.dropbox.com/s/hr28wyzaroghran/computercraft_app_store.lua?dl=1")
  55.     Web = http.get("http://pastebin.com/download.php?i=A7wGH3ty")
  56.     f = fs.open("startup", "w")
  57.     f.write(Startup.readAll())
  58.     f.close()
  59.     f = fs.open(Root .. "ungarscool1os.lua", "w")
  60.     f.write(Network.readAll())
  61.     f.close()
  62.     f = fs.open("update", "w")
  63.     f.write(update.readAll())
  64.     f.close()
  65.     f = fs.open("store", "w")
  66.     f.write(store.readAll())
  67.     f.close()
  68. f = fs.open("web", "w")
  69.     f.write(web.readAll())
  70.     f.close()
  71.     term.setTextColor(colors.lime)
  72.     print("\nDone!")
  73.     os.sleep(1)
  74.     Reset()
  75.     print("Ungarscool1 OS Downloaded Successfully!\nEdition: Computercraft")
  76.     term.setTextColor(colors.yellow)
  77.     print("\n(-)Ok")
  78.     term.setTextColor(colors.white)
  79.     repeat
  80.             event, key = os.pullEvent("key")
  81.             os.sleep(0.1)
  82.     until key == 28
  83.     os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement