Advertisement
kirkarr

KirkaOS BETA

Jan 23rd, 2024 (edited)
1,357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1. --tfwacsv
  2. local sx, sy = term.getSize()
  3. term.clear()
  4. term.setCursorPos(sx/2-8,sy/2)
  5. term.write("Getting updates")
  6. local codereq,reason = http.get("https://pastebin.com/raw/w7jKxqMm")
  7. if codereq ~= nil then
  8.     local self = fs.open("startup.lua","r")
  9.     local content = self.readAll()
  10.     self.close()
  11.     local code = codereq.readAll()
  12.     codereq.close()
  13.     if code ~= content then
  14.         term.clear()
  15.         term.setCursorPos(sx/2-7,sy/2)
  16.         term.write("UPDATE FOUND")
  17.         term.setCursorPos(sx/2-13,sy/2+1)
  18.         term.write("DO YOU WANT TO INSTALL IT?")
  19.         term.setCursorPos(sx/2-12,sy/2+2)
  20.         term.write("Write 'update' to confirm")
  21.         term.setCursorPos(sx/2-7,sy/2+3)
  22.         term.write("Answer: ")
  23.         allow = read()
  24.         if allow == "update" then
  25.             fs.delete("startup.lua")
  26.             local redact = fs.open("startup.lua","w")
  27.             redact.write(code)
  28.             redact.close()
  29.             for i=1,100 do
  30.                 term.clear()
  31.                 term.setCursorPos(1,1)
  32.                 term.write("Update completed "..i.."% ("..(5-i*0.05).." seconds)")
  33.                 sleep(0.05)
  34.             end
  35.             os.reboot()
  36.         else
  37.             term.clear()
  38.             term.setCursorPos(1,1)
  39.             term.write("Update cancelled")
  40.         end
  41.     end
  42. else
  43.     term.clear()
  44.     term.setCursorPos(1,1)
  45.     term.write("Cannot load update, because")
  46.     term.setCursorPos(1,2)
  47.     term.write(reason)
  48.     term.setCursorPos(1,3)
  49.     term.write("Using older version of OS")
  50.     sleep(3)
  51. end
  52. local title = "KirkaOS BETA"
  53. local username = "ROOT"
  54. local password = "BOOT"
  55. local loadtime = 0
  56. for i=1, 100 do
  57.     loadstr = i.."/100"
  58.     progress = (i/100)*20
  59.     term.clear()
  60.     term.setCursorPos(sx/2-#title/2,sy/2)
  61.     term.write(title)
  62.     term.setCursorPos(sx/2-#loadstr/2,sy/2+1)
  63.     term.write(loadstr)
  64.     term.setCursorPos(sx/2-progress/2,sy/2+2)
  65.     term.write(string.rep("#",progress))
  66.     loadtime = loadtime + (100-i)/1000
  67.     sleep((100-i)/1000)
  68. end
  69. term.setCursorPos(1,1)
  70. term.write("Loaded on "..loadtime.."s")
  71. sleep(1.5)
  72. --[[term.clear()
  73. term.setCursorPos(1,1)
  74. term.write("Enter username: ")
  75. inpname = read()
  76. term.setCursorPos(1,2)
  77. term.write("Enter password: ")
  78. ]]--inppassword = read()
  79. --if inpname == username and inppassword == password then
  80.     term.clear()
  81.     term.setCursorPos(1,1)
  82.     term.write("Welcome back, "..username.."!")
  83.     term.setCursorPos(1,2)
  84.     term.write("Processing...")
  85.     sleep(2)
  86.     term.setCursorPos(1,1)
  87.     term.clear()
  88. --[[else
  89.     term.clear()
  90.     term.setCursorPos(1,1)
  91.     term.write("Incorrect username or password")
  92.     sleep(0.5)
  93.     os.shutdown()
  94. end]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement