Guest User

easyinstall2

a guest
Jun 16th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. local w,h = term.getSize()
  2.  
  3. --Center Text
  4.  
  5. function printCentered (y,s)
  6.     local x = math.floor((w - string.len(s)) /2)
  7.     term.setCursorPos(x,y)
  8.     term.clearLine()
  9.     term.write(s)
  10. end
  11.  
  12. --Drawmenu
  13.  
  14. local nOption = 1
  15.  
  16. local function drawMenu()
  17.     term.setBackgroundColor(colors.cyan)
  18.     term.clear()
  19.     term.setCursorPos(1,1)
  20.     local logo = paintutils.loadImage("os/.logo")
  21.     paintutils.drawImage(logo, 1, 1)
  22.     term.setBackgroundColor(colors.cyan)
  23.    
  24.     term.setCursorPos(w-11,1)
  25.     if nOption == 1 then
  26.         term.write("YES")
  27.     elseif nOption == 2 then
  28.         term.write("NO")
  29.     elseif nOption == 3 then
  30.         term.write("EXIT SETUP")
  31.     else
  32.         end
  33. end    
  34.  
  35. --GUI
  36.  
  37. term.clear()
  38. local function drawFrontend()
  39.     printCentered(math.floor(h/2) -3, "")
  40.     printCentered(math.floor(h/2) -2, "INSTALL USING FLOPPY DISK?")
  41.     printCentered(math.floor(h/2) -1, "")
  42.     printCentered(math.floor(h/2) + 0, (nOption == 1 and "[ YES ]") or "YES")
  43.     printCentered(math.floor(h/2) + 1, (nOption == 2 and "[ NO ]") or "NO")
  44.     printCentered(math.floor(h/2) + 2, (nOption == 3 and "[ EXIT SETUP ]") or "EXIT SETUP")
  45. end
  46.  
  47. --Display
  48.  
  49. drawMenu()
  50. drawFrontend()
  51.  
  52. while true do
  53.     local e,p = os.pullEvent()
  54.         if e == "key" then
  55.             local key = p
  56.             if key == 17 or key == 200 then
  57.            
  58.                 if nOption > 1 then
  59.                     nOption = nOption -1
  60.                     drawMenu()
  61.                     drawFrontend()
  62.                 end
  63.             elseif key == 31 or key == 208 then
  64.                 if nOption < 3 then
  65.                     nOption = nOption +1
  66.                     drawMenu()
  67.                     drawFrontend()
  68.                 end
  69.         elseif key == 28 then
  70.             break
  71. end
  72. end
  73. end
  74.  
  75. term.clear()
  76.  
  77. --Conditions
  78. if nOption == 1 then
  79.     shell.run("rm disk/*")
  80.     shell.run("pastebin get n5e0HdMR disk/startup")
  81.     shell.run("pastebin get GQyFnaPu disk/installer")
  82.     shell.run("pastebin get pbLcNfKv disk/install")
  83.     shell.run("disk/install")  
  84. elseif nOption == 2 then
  85.     shell.run("pastebin get G7Teq7mR startup")
  86.     shell.run("pastebin get GQyFnaPu os/install")
  87.     shell.run("pastebin get fAUEnic0 os/installer")
  88.     os.reboot()
  89.     shell.run("os/installer")
  90. else
  91.     term.setBackgroundColor(colors.black)
  92.     term.clear()
  93.     term.setCursorPos(1,1)
  94. end
Add Comment
Please, Sign In to add comment