Thomas9666

[LUA] TomOS installer

Feb 26th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. local driveSide
  2. for _, side in ipairs(rs.getSides()) do
  3. if peripheral.isPresent(side) and peripheral.getType(side) == "drive" then
  4. driveSide = side
  5. break
  6. end
  7. end
  8.  
  9.  
  10. apichek = fs.exists("/disk/tom")
  11.  
  12. if apichek == false then
  13. shell.run("pastebin", "get", "nRVEA7zM","/disk/tom")
  14. shell.run("pastebin", "get", "igXUE29e","/disk/button")
  15. shell.run("label", "set", driveside, "TomOS Installer")
  16. shell.run("/disk/installer")
  17.  
  18. elseif apichek == true then
  19. os.loadAPI("/disk/tom")
  20. os.loadAPI("/disk/button")
  21. tom.gui()
  22. tom.header("Do you wish to install TomOS?")
  23. buty = 6
  24. button.makeButton(buty, "YES")
  25. buty = buty + 2
  26. button.makeButton(buty, "NO")
  27. local opt = button.selectButton(6,2)
  28.  
  29. if opt == 1 then
  30. tom.gui()
  31. tom.header("Enter unique label for computer")
  32. tom.newl("")
  33. local lab = read()
  34. shell.run("label", "set", lab)
  35. tom.gui()
  36. tom.header("Please create first user:")
  37. tom.newl("")
  38. local name = read()
  39. tom.gui()
  40. tom.header("Please enter your password:")
  41. tom.newl("")
  42. local passwd = read()
  43. tom.gui()
  44. tom.header("Generating new user file")
  45. fs.makeDir("/os/.users")
  46. fpath = ("/os/.users/" .. name)
  47. local fuse = fs.open(fpath,"w")
  48. fuse.write(passwd)
  49. sleep(1)
  50. tom.gui()
  51. tom.header("User file created, installing TomOS")
  52. fs.makeDir("/os/api")
  53. fs.copy("/disk/tom", "/os/api/tom")
  54. fs.copy("/disk/button", "/os/api/button")
  55. shell.run("pastebin", "get", "6AHrNpfW", "clc")
  56. shell.run("pastebin", "get", "LjMsFYju", "/os/term")
  57. shell.run("pastebin", "get", "QjkpmgZD", "/os/.menu")
  58. shell.run("pastebin", "get", "gJWsdXJq", "startup")
  59. shell.run("pastebin", "get", "4BwVAH9J", "/os/progms")
  60. shell.run("pastebin", "get", "nFCN3FjE", "/os/shut")
  61. shell.run("pastebin", "get", "SfHY9j9i", "back")
  62. fs.makeDir("prog")
  63. sleep(2)
  64. tom.gui()
  65. tom.header("TomOS installed. Rebooting")
  66. sleep(3)
  67. disk.eject(driveside)
  68. os.reboot()
  69. elseif opt == 2 then
  70. tom.centre("Ok, rebooting")
  71. sleep(1)
  72. os.reboot()
  73. end
  74. end
Add Comment
Please, Sign In to add comment