Advertisement
SuperRavenSn1per

SoarOS Installer

Jul 31st, 2022 (edited)
1,229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local repo = "https://raw.githubusercontent.com/SuperRavenSn1per/SoarOS/"
  2. local branch = "main/"
  3.  
  4. local function download(fileName)
  5.     local content = http.get(repo..branch..fileName).readAll()
  6.     local f = fs.open(fileName, "w")
  7.     f.write(content)
  8.     f.close()
  9. end
  10.  
  11. function writeQ(type)
  12.     if type == "q" then
  13.         write("[")
  14.         term.setTextColor(colors.orange)
  15.         write("?")
  16.         term.setTextColor(colors.white)
  17.         write("] : ")
  18.     elseif type == "w" then
  19.         write("[")
  20.         term.setTextColor(colors.red)
  21.         write("!")
  22.         term.setTextColor(colors.white)
  23.         write("] : ")
  24.     elseif type == "g" then
  25.         write("[")
  26.         term.setTextColor(colors.green)
  27.         write("@")
  28.         term.setTextColor(colors.white)
  29.         write("] : ")
  30.     end
  31. end
  32.  
  33. term.clear()
  34. term.setCursorPos(1,1)
  35. print("[ SoarOS Installer ]")
  36. print("Are you sure you want to install SoarOS? (Y/N)\n")
  37.  
  38. while true do
  39.     writeQ("q")
  40.     local input = read()
  41.     if string.lower(input) == "y" then
  42.         writeQ("Downloading installer...", "g")
  43.         download("installer.lua")
  44.         writeQ("Running installer...", "g")
  45.         shell.run("installer.lua")
  46.         break
  47.     elseif string.lower(input) == "n" then
  48.         term.clear()
  49.         term.setCursorPos(1,1)
  50.         print("Installation cancelled.")   
  51.     else
  52.         print("Please answer with 'Y' or 'N'")
  53.     end
  54. end
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement