gravitowl

GraviMail Server Installer

Mar 10th, 2021 (edited)
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. local w, h = term.getSize()
  2.  
  3. function printCentered(text, y)
  4. term.setCursorPos(w/2 - #text/2, y)
  5. term.write(text)
  6. end
  7.  
  8. term.clear()
  9.  
  10. term.setCursorPos(1,1)
  11. print(string.rep("-", w))
  12. printCentered("Welcome to the GraviMail server wizard.", 2)
  13. printCentered("This will lead you through", 3)
  14. printCentered("installing the GraviMail server.", 4)
  15. print(string.rep("-", w))
  16. os.sleep(0.5)
  17. print("\n")
  18. print("Which side is your modem on?")
  19. print("[top, bottom, back, front, left, right]")
  20. local side = read()
  21. print("Modem at side: "..side)
  22. os.sleep(0.5)
  23.  
  24. function askForMaster()
  25. print("What is the master server ID?")
  26. local master = read()
  27. if not tonumber(master) then
  28. print("Master ID not a number.")
  29. os.sleep(0.2)
  30. askForMaster()
  31. else
  32. return master
  33. end
  34. end
  35.  
  36. local master = askForMaster()
  37. os.sleep(0.5)
  38. print("Creating preference file...")
  39. os.sleep(0.2)
  40. file = fs.open("gravimail/server/pref", "w")
  41. file.write(textutils.serialise({side=side,master=master}))
  42. file.close()
  43. print("Preference file created in gravimail/server/pref. Do not delete this file!")
  44. os.sleep(0.5)
  45. print("Removing old startup files...")
  46. if fs.exists("startup") then
  47. fs.delete("startup")
  48. end
  49. print("Downloading GraviMail server files...")
  50. shell.run("pastebin","get","https://pastebin.com/4cEztaWS","startup")
  51. os.sleep(0.5)
  52. print("Rebooting...")
  53. os.sleep(0.5)
  54. os.reboot()
Add Comment
Please, Sign In to add comment