PaffcioStudio

Instalacja DooOS

Feb 18th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.90 KB | None | 0 0
  1. local function centerPrint(text,y,distance)
  2.         if text == nil then text = "" end
  3.         if y == nil then y = 1 end
  4.         if distance == nil then distance = 0 end
  5.         local dx, dy = term.getSize()
  6.         term.setCursorPos(dx/2-#text/2-distance,y)
  7.         print(text)
  8. end
  9.  
  10. local function clear()
  11.         term.clear()
  12.         term.setCursorPos(1,1)
  13. end
  14.  
  15. local function bg(color)
  16.         term.setBackgroundColor(color)
  17. end
  18.  
  19. local function text(color)
  20.         term.setTextColor(color)
  21. end
  22.  
  23.  
  24. local version = "1.0"
  25.  
  26. if term.isColor() then
  27.      local isclicking = true
  28.      while isclicking do
  29.           bg(colors.gray)
  30.           text(colors.white)
  31.           clear()
  32.           centerPrint("DooOS - Minimalistyczny system Doo",7)
  33.           text(colors.cyan)
  34.           centerPrint("Czy chcesz pobrac i zainstalowac ten system?",8)
  35.           term.setCursorPos(15,10)
  36.           bg(colors.lime)
  37.           text(colors.white)
  38.           write(" Tak ")
  39.           term.setCursorPos(32,10)
  40.           bg(colors.red)
  41.           write(" Nie ")
  42.           bg(colors.gray)
  43.           local event,button,x,y = os.pullEvent("mouse_click")
  44.           if x >= 15 and x <= 20 and y == 10 then
  45.                isclicking = false
  46.                bg(colors.gray)
  47.                text(colors.orange)
  48.                clear()
  49.                centerPrint("Pobieranie i instalowanie systemu w toku...",10)
  50.                sleep(3)
  51.                shell.run("pastebin get W5etF99L git")
  52.                shell.run("git PaffcioStudio DooOS")
  53.                clear()
  54.                centerPrint("Konczenie instalacji, juz prawie :)",10)
  55.                sleep(3)
  56.                fs.delete("git")
  57.                clear()
  58.                centerPrint("Konczenie instalacji, juz prawie :) [1/7]",10)
  59.                sleep(0.1)
  60.                fs.delete("LICENSE")
  61.                clear()
  62.                fs.delete(".gitignore")
  63.                clear()
  64.                centerPrint("Konczenie instalacji, juz prawie :) [2/7]",10)
  65.                sleep(0.1)
  66.                fs.move("DooOS/*", "_bak")
  67.                clear()
  68.                centerPrint("Konczenie instalacji, juz prawie :) [3/7]",10)
  69.                sleep(0.1)
  70.                fs.move("_bak/DooOS/*", "/DooOS")
  71.                clear()
  72.                centerPrint("Konczenie instalacji, juz prawie :) [4/7]",10)
  73.                sleep(0.1)
  74.                fs.move("_bak/startup", "startup")
  75.                clear()
  76.                fs.move("_bak/edit", "edit")
  77.                clear()
  78.                fs.move("_bak/hilight", "hilight")
  79.                clear()
  80.                fs.move("_bak/pastebin", "pastebin")
  81.                clear()
  82.                clear()
  83.                centerPrint("Konczenie instalacji, juz prawie :) [5/7]",10)
  84.                sleep(0.1)
  85.                fs.delete("_bak")
  86.                clear()
  87.                fs.delete(".gitignore")
  88.                clear()
  89.                centerPrint("Konczenie instalacji, juz prawie :) [6/7]",10)
  90.                sleep(0.1)
  91.                fs.delete("DooOS_Instalacja")
  92.                clear()
  93.                centerPrint("Konczenie instalacji, juz prawie :) [7/7]",10)
  94.                clear()
  95.                centerPrint("Zaczynamy... =)",10)
  96.                sleep(2)
  97.                os.reboot()
  98.           elseif x >= 32 and x <= 36 and y == 10 then
  99.                bg(colors.gray)
  100.                text(colors.orange)
  101.                centerPrint("Instalacja przerwana.",15)
  102.                centerPrint("Za moment nastapi uruchomienie CraftOS",16)
  103.                sleep(3)
  104.                bg(colors.black)
  105.                text(colors.white)
  106.                clear()
  107.                isclicking = false
  108.                os.reboot()
  109.                break
  110.           end    
  111.      end        
  112. else
  113.      print("Do zainstalowania DooOS wymagany jest zaawansowany")
  114.      print("komputer. Instalacja zostanie przerwana.")
  115.      sleep(4)
  116.      os.reboot()
  117. end
Add Comment
Please, Sign In to add comment