Advertisement
Ungarscool1

Installer OS

Jun 21st, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 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")
  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. f = fs.open("startup", "w")
  55. f.write(Startup.readAll())
  56. f.close()
  57. f = fs.open(Root .. "ungarscool1os.lua", "w")
  58. f.write(Network.readAll())
  59. f.close()
  60. f = fs.open("update", "w")
  61. f.write(update.readAll())
  62. f.close()
  63. term.setTextColor(colors.lime)
  64. print("\nDone!")
  65. os.sleep(1)
  66. Reset()
  67. print("Ungarscool1 OS Downloaded Successfully!\nEdition: Computercraft")
  68. term.setTextColor(colors.yellow)
  69. print("\n(-)Ok")
  70. term.setTextColor(colors.white)
  71. repeat
  72.     event, key = os.pullEvent("key")
  73.     os.sleep(0.1)
  74. until key == 28
  75. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement