Advertisement
Le_JuiceBOX

os_installer

Aug 16th, 2022 (edited)
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.44 KB | None | 0 0
  1. local PASTEBIN_URL = "https://pastebin.com/"
  2. local PASTEBIN_RAW_URL = "https://pastebin.com/raw/"
  3. local SEPERATOR = "======================================="
  4. local PROGDIR = [[OS\PROG\]]
  5.  
  6. local repo = {
  7.     {Name = "FrogpulpOS - Turtle", FileName = "os", Id = "rqwVKAfR", Path="OS/", UsePasteLink = true},
  8.     {Name = "FrogpulpOS - Computer", FileName = "os", Id = "m4Ljnijb", Path="OS/", UsePasteLink = true},
  9.     {Name = "Turtle - Bore v2.1", FileName = "bore_v2-1", Id = "VdYprGR1", Path = PROGDIR, UsePasteLink = true},
  10.     {Name = "Turtle - Bore v2", FileName = "bore_v2",Id = "7h9kZ1ZM", Path = PROGDIR, UsePasteLink = true},
  11.     {Name = "Turtle - Floor", FileName = "bore_floor",Id = "nMxM1syd", Path = PROGDIR, UsePasteLink = true},
  12.     {Name = "Bore Blacklist - Junk Stone", FileName = "bore_blacklist_junkStone",Id = "3dbkNt7w", Path = PROGDIR, UsePasteLink = false},
  13.     {Name = "Lava Refuel", FileName = "lava_refuel",Id = "nFSUKiYE", Path = PROGDIR, UsePasteLink = false},
  14. }
  15.  
  16. function makeFile(name, repoInd)
  17.     local fi = repo[repoInd]
  18.     local n = fi.Path..name..".lua"
  19.     if fs.exists(n) then shell.run("delete "..n); end
  20.     if fi.UsePasteLink then
  21.         local file = fs.open(n,"w")
  22.         file.write("shell.run(\"pastebin run "..repo[repoInd].Id.."\")")
  23.         file.close()
  24.     else
  25.         shell.run("pastebin get "..fi.Id.." "..fi.Path..fi.FileName..".lua")
  26.     end
  27.    
  28. end
  29.  
  30. function split(inputstr, sep)
  31.     if sep == nil then
  32.             sep = "%s"
  33.     end
  34.     local t={}
  35.     for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  36.             table.insert(t, str)
  37.     end
  38.     return t
  39. end
  40.  
  41.  
  42. function Main()
  43.     --makeFile("installer","Era6PJf4")
  44.     local installedOS = false
  45.     shell.run("clear")
  46.     print(SEPERATOR)
  47.     print("Installer ~")
  48.     print(SEPERATOR)
  49.     for i,paste in pairs(repo) do print(i..". "..paste.Name) end
  50.     print("\nInput files to download: (ex. 1 or 1 3 4, q to quit)\n")
  51.     local txt = io.read()
  52.     local input = split(txt)
  53.     for i,num in pairs(input) do
  54.         if num == "q" then shell.run("reboot") end
  55.         local paste = repo[tonumber(num)]
  56.         if tonumber(num) == 1 then installedOS = true end
  57.         makeFile(paste.FileName,tonumber(num))
  58.     end
  59.     shell.run("clear")
  60.     print(tostring(#input).." files downloaded...")
  61.     os.sleep(1)
  62.     if installedOS then
  63.         shell.run("OS/os.lua")
  64.     else
  65.         shell.run("reboot")
  66.     end
  67. end
  68.  
  69. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement