Advertisement
Guest User

SERVERClient

a guest
Mar 1st, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. --[[ Local Variables ]]--
  2. -- Root Directories & Extentions --
  3. local Root = ".Network/"
  4. local uRoot = ".Network/Users/"
  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("E-Mail Network")
  17.  term.setTextColor(colors.yellow)
  18.     printTR("- Installer -")
  19.  term.setTextColor(colors.white)
  20.     printTM("[ Server Edition ]")
  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(uRoot)
  50. print("Getting Needed Files...")
  51. Network = http.get("http://dl.dropbox.com/u/39147094/E-Mail%20Network/Server/Network.lua")
  52. Startup = http.get("http://dl.dropbox.com/u/39147094/E-Mail%20Network/Server/Startup")
  53. f = fs.open("startup", "w")
  54. f.write(Startup.readAll())
  55. f.close()
  56. f = fs.open(Root .. "Network.lua", "w")
  57. f.write(Network.readAll())
  58. f.close()
  59. term.setTextColor(colors.lime)
  60. print("\nDone!")
  61. os.sleep(1)
  62. Reset()
  63. print("E-Mail Server Downloaded Successfully!\nEdition: Server")
  64. term.setTextColor(colors.yellow)
  65. print("\n(-)Ok")
  66. repeat
  67.     event, key = os.pullEvent("key")
  68.     os.sleep(0.1)
  69. until key == 28
  70. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement