Elrol

Fallout Styled server/terminal installer

Apr 10th, 2020 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local color = colors.green
  2. local w, h = term.getSize()
  3.  
  4. local serverFiles = {}
  5.     serverFiles.server = "G8jS60D1"
  6.     serverFiles.startup = "pAuEZD46"
  7.  
  8. local clientFiles = {}
  9.     clientFiles.client = "dSYLZtkX"
  10.     clientFiles.menu = "iz95vBeb"
  11.     clientFiles.startup = "kvwgz7L0"
  12.  
  13. function init()
  14.     term.setTextColor(color)
  15.     term.setBackgroundColor(colors.black)
  16.     term.clear()
  17.     term.setCursorPos(1,1)
  18.     info("ROBCO INDUSTRIES UNIFIED OPERATING SYSTEM", true)
  19.     info("COPYRIGHT 2019-2020 ROBCO INDUSTRIES", true)
  20.     info("-Server 1-", true)
  21.     info(nil, false)
  22.     info("Terminal Setup", false)
  23.     info("======================", false)
  24.     info("Install for Terminal or Server?", false)
  25.     hr()
  26.     local side = read()
  27.     if side == "server" or side == "Server" then
  28.         server()
  29.     elseif side == "terminal" or side == "Terminal" then
  30.         client()
  31.     else
  32.         term.clear()
  33.         term.setCursorPos(1,1)
  34.     end
  35. end
  36.  
  37. function hr()
  38.     x, y = term.getCursorPos()
  39.     for i = 1, w, 1 do
  40.         write("-")
  41.     end
  42.     term.setCursorPos(1, y+1)
  43. end
  44.  
  45. function info(text, isCenter)
  46.     if text == nil then
  47.         term.setCursorPos(1, y+2)
  48.     elseif isCenter then
  49.         x, y = term.getCursorPos()
  50.         x = (w - #text) / 2
  51.         term.setCursorPos(x, y)
  52.         write(text)
  53.         term.setCursorPos(1, y+1)
  54.     else
  55.         print(text)
  56.     end
  57. end
  58.  
  59. function install(link,file)
  60.     if fs.exists(file) then
  61.         fs.delete(file)
  62.         shell.run("pastebin", "get", link, file)
  63.         print("Updated "..file)
  64.     else
  65.         shell.run("pastebin", "get", link, file)
  66.         print("Installed "..file)
  67.     end
  68. end
  69.  
  70. function server()
  71.     info("Installing Server", false)
  72.     for f, l in pairs(serverFiles) do
  73.         install(l, f)
  74.     end
  75. end
  76.  
  77. function client()
  78.     info("Intalling Client", false)
  79.     for f, l in pairs(clientFiles) do
  80.         install(l, f)
  81.     end
  82. end
  83.  
  84. init()
Add Comment
Please, Sign In to add comment