Advertisement
Guest User

reinstall

a guest
Feb 3rd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.31 KB | None | 0 0
  1.  
  2. if not fs.exists("ondOS") then
  3.   fs.makeDir("ondOS")
  4.   fs.makeDir("ondOS/Users")
  5.   fs.makeDir("ondOS/Lua")
  6. end
  7.  
  8. if not fs.exists("ondOS/Lua/lang") then
  9.   shell.run("pastebin get qVbWnL4N ondOS/Lua/lang")
  10. end
  11.  
  12. shell.run("ondOS/Lua/lang")
  13. shell.run("clear")
  14.  
  15. local l = lang
  16.  
  17. local function newSession(title, subtitle)
  18.   term.setBackgroundColor(colors.blue)
  19.   paintutils.drawFilledBox(1, 1, 51, 19)
  20.   term.setBackgroundColor(colors.cyan)
  21.   paintutils.drawFilledBox(1, 1, 51, 3)
  22.   term.setTextColor(colors.white)
  23.   local pos = #title / 3
  24.   term.setCursorPos(pos, 2)
  25.   write(title)
  26.   term.setCursorPos(1, 4)
  27.   term.setBackgroundColor(colors.blue)
  28.   print(subtitle)
  29.   return true
  30. end
  31.  
  32. newSession(l.setup1_title, l.setup1_subtitle)
  33. redo = true
  34.  
  35. local function iGetCode()
  36.   term.setCursorPos(1, 8)
  37.   print(l.setup1_info)
  38.   write(l.setup1_code .. ":                 ")
  39.   term.setTextColor(colors.yellow)
  40.   term.setCursorPos(7, 9)
  41.   input = read()
  42.  
  43.   if input ~= "cancel" and input ~= "terminal" then
  44.     num = math.random(100, 999)
  45.     term.setCursorPos(10, 10)
  46.     term.setTextColor(colors.yellow)
  47.     write("Verifying..                ")
  48.     if input == "" or string.find(input, " ") then
  49.       sleep(.3)
  50.       term.setCursorPos(10, 10)
  51.       term.setTextColor(colors.red)
  52.       write(l.setup1_novar .. "           ")
  53.       redo = true
  54.       sleep(2)
  55.       term.setTextColor(colors.white)
  56.       iGetCode()
  57.       return
  58.     end
  59.     term.setCursorPos(1, 15)
  60.     term.setTextColor(colors.blue)
  61.     shell.run("pastebin get " .. input .. " testlang" .. num)
  62.     local file = fs.open("testlang" .. num, "r")
  63.     local content = file.readAll()
  64.     if not string.find(content, "lang") then
  65.       term.setCursorPos(10, 10)
  66.       term.setTextColor(colors.orange)
  67.       write(l.setup1_nolang .. "      ")
  68.       term.setTextColor(colors.white)
  69.       sleep(.5)
  70.       redo = true
  71.     else
  72.       term.setCursorPos(10, 10)
  73.       term.setTextColor(colors.green)
  74.       write(l.setup1_set .. "           ")
  75.       if fs.exists("ondOS/Lua/lang") then
  76.         fs.delete("ondOS/Lua/lang")
  77.       end
  78.       shell.run("testlang" .. num)
  79.       l = lang
  80.       shell.run("copy testlang" .. num .. " ondOS/Lua/lang")
  81.       term.setTextColor(colors.white)
  82.       sleep(3)
  83.       redo = false
  84.     end
  85.   elseif input == "terminal" then
  86.     shell.run("ondOS/Lua/cmdprompt")
  87.     return
  88.   elseif input == "cancel" then
  89.     redo = false
  90.   end
  91.   if redo == true then
  92.     redo = false
  93.     iGetCode()
  94.     return
  95.   end
  96. end
  97.  
  98. iGetCode()
  99.  
  100. local function contains(text, char)
  101.   if string.find(text, char) then
  102.     return true
  103.   else
  104.     return false
  105.   end
  106. end
  107.  
  108. local function getUserInfo()
  109.  
  110. redo = false
  111.  
  112. newSession(l.setup2_title, l.setup2_subtitle)
  113. term.setTextColor(colors.yellow)
  114. term.setCursorPos(12, 7)
  115. write(l.setup2_name)
  116. term.setTextColor(colors.white)
  117. term.setCursorPos(4, 8)
  118. username = read()
  119. term.setTextColor(colors.yellow)
  120. term.setCursorPos(12, 9)
  121. write(l.setup2_password)
  122. term.setTextColor(colors.white)
  123. term.setCursorPos(4, 10)
  124. password = read()
  125.  
  126. if contains(username, "/") or contains(username, "*") or contains(username, "!") or contains(username, "rom") or contains(username, " ") then
  127.   term.setCursorPos(8, 12)
  128.   term.setTextColor(colors.red)
  129.   write(l.setup2_userinnapt .. "                      ")
  130.   sleep(2)
  131.   redo = true
  132. end
  133.  
  134. if username == "" then
  135.   term.setCursorPos(8, 12)
  136.   term.setTextColor(colors.red)
  137.   write(l.setup2_nouser .. "                     ")
  138.   sleep(2)
  139.   redo = true
  140. end
  141.  
  142. if fs.exists("ondOS/Users/" .. username) then
  143.   term.setCursorPos(8, 12)
  144.   term.setTextColor(colors.red)
  145.   write(l.setup2_userexists .. "                        ")
  146.   sleep(2)
  147.   redo = false
  148. end
  149.  
  150. if contains(password, "/") or contains(password, "*") or contains(password, "!") or contains(password, "rom") or contains(password, " ") then
  151.   term.setCursorPos(8, 12)
  152.   term.setTextColor(colors.red)
  153.   write(l.setup2_passinnapt .. "                         ")
  154.   sleep(2)
  155.   redo = true
  156. end
  157.  
  158. if redo == true then
  159.   getUserInfo()
  160.   return
  161. end
  162.  
  163. newSession(l.settingup, l.wait)
  164. sleep(.75)
  165. fs.makeDir("ondOS/Users/" .. username)
  166. sleep(.75)
  167. fs.makeDir("ondOS/Users/" .. username .. "/pass_" .. password)
  168. sleep(.75)
  169. fs.makeDir("ondOS/Users/" .. username .. "/admin")
  170.  
  171.  
  172. end
  173.  
  174. getUserInfo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement