tt_thoma

oclibinstaller.lua

Jun 25th, 2021 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.56 KB | None | 0 0
  1. local component = require("component")
  2. local term = require("term")
  3. local fs = require("filesystem")
  4. local sh = require("shell")
  5. local forceinstallation = false
  6. local pastebincode = "vShCR471"
  7.  
  8. --# with term.read, I got things like "input\n" so i fix this problem until they fix themselves
  9. function c(str)
  10.   if component.isAvailable(str) then
  11.     return true
  12.   else
  13.     return false
  14.   end
  15. end
  16.  
  17. function mkdir(foldername)
  18.   fs.makeDirectory(foldername)
  19. end
  20.  
  21. local args, _ = sh.parse(...)
  22. local arg = table.concat(args)
  23. local forceinstallation = arg == "force"
  24.  
  25. if (c("screen") and c("inventory_controller") and c("keyboard") and c("modem") and c("internet")) or forceinstallation then
  26.   print("Your computer seems ready. Have you installed OpenOS on your robot's hard disk ? [Y/n] ")
  27.   r = term.read()
  28.   if r == "n\n" or r == "N\n" then
  29.     print("Once the installation finished, reboot your computer and relaunch the setup by 'pastebin run " .. pastebincode .. "'.")
  30.     os.execute("install")
  31.     os.reboot()
  32.   end
  33.   print("Proceed to the installation ? [Y/n]")
  34.   r = term.read()
  35.   if r == "y\n" or r == "Y\n" then
  36.     mkdir("/home/oclib")
  37.     mkdir("/home/oclib/builder")
  38.     mkdir("/home/oclib/builder/models")
  39.     mkdir("/usr/objectstore")
  40.     --# os.execute("cd /home/oclib") --# Useless
  41.     os.setenv("PWD", "/home/oclib")
  42.     os.execute("wget https://raw.githubusercontent.com/InfinitiesLoop/oclib/8273255478f9b3b1a77e36a4fdbda8744ba9a569/init.lua")
  43.     os.execute("wget https://raw.githubusercontent.com/InfinitiesLoop/oclib/master/init.files")
  44.     print("Launching the installation program")
  45.     dofile("init.lua")
  46.     os.execute("wget https://gist.githubusercontent.com/Fingercomp/6563c64d70a4472f26923f78d77caeb9/raw/aa4f461ddee2af70a8040065be8974069e240e27/crash.lua")
  47.     os.setenv("PWD", "/home")
  48.     os.execute("pastebin get YErPe1FF build")
  49.     print()
  50.     print("Installation complete! (maybe)")
  51.     else
  52.       print("You can run again the installer by using 'pastebin run " .. pastebincode .. "'.")
  53.     end
  54. else
  55.   --# os.execute("resolution 50 16") Not useful
  56.   print("Check if your robot have all these components:")
  57.   print("- Disk Drive")
  58.   print("- Upgrade Container (Tier 1)")
  59.   print("- Upgrade Container (Tier 2)")
  60.   print("- Hover Upgrade (Tier 2)")
  61.   print("- Angel Upgrade")
  62.   print("- Inventory Controller Upgrade")
  63.   print("- Inventory Upgrade")
  64.   print("- Network Card")
  65.   print("- Internet Card")
  66.   print("- Central Processing Unit (Tier 3)")
  67.   print("- Memory (Tier 3.5) 2x")
  68.   print("- Hard Disk Drive (Tier 3)")
  69. end
Add Comment
Please, Sign In to add comment