Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --installer
- rootPath = "/"
- prgPath = rootPath .. "program_files/"
- osFilesPath = rootPath .. "os_files/"
- sysPath = osFilesPath .. "sys/"
- usrPath = osFilesPath .. "usr/"
- regPath = sysPath .. "reg/"
- funcPath = sysPath .. "funcs/"
- restPath = sysPath .. "recovery/recovery_files/"
- --recreate the folder structure
- fs.makeDir(osFilesPath)
- fs.makeDir(sysPath)
- fs.makeDir(funcPath)
- fs.makeDir(regPath)
- fs.makeDir(usrPath)
- fs.makeDir(usrPath .. "Admin")
- fs.makeDir(prgPath)
- if not fs.exists(prgPath) then
- fs.makeDir(prgPath)
- end
- shell.run("pastebin","get", "R1U1Tbu3", restPath .. "Aset")
- shell.run("pastebin","get", "1aa8Wui8", restPath .. "calcPlus")
- shell.run("pastebin","get", "qByWkj7N", restPath .. "cred")
- shell.run("pastebin","get", "DQJi7wSM", restPath .. "func")
- shell.run("pastebin","get", "JwgvEBwM", restPath .. "ink")
- shell.run("pastebin","get", "ubWUJ3TZ", restPath .. "luaIDE")
- shell.run("pastebin","get", "CwRqhj7N", restPath .. "main")
- shell.run("pastebin","get", "ZYcCQk52", restPath .. "params")
- shell.run("pastebin","get", "PB2yNBmE", restPath .. "periph")
- shell.run("pastebin","get", "ZermQtR2", restPath .. "prg")
- shell.run("pastebin","get", "ufWg1kQf", restPath .. "startup")
- shell.run("pastebin","get", "k2vnjUsg", restPath .. "ui")
- shell.run("pastebin","get", "ScTChDUh", restPath .. "usr")
- shell.run("pastebin","get", "XtC0JPQw", sysPath .. "/recover/recovery")
- --recreate the files
- fs.copy(restPath .. "cred", funcPath .. "cred")
- --fs.copy(restPath .. "debug", funcPath .. "debug")
- fs.copy(restPath .. "func", funcPath .. "func")
- fs.copy(restPath .. "periph", funcPath .. "periph")
- fs.copy(restPath .. "prg", regPath .. "prg")
- --fs.copy(restPath .. "settings", regPath .. "settings")
- fs.copy(restPath .. "usr", regPath .. "usr")
- fs.copy(restPath .. "main", sysPath .. "main")
- fs.copy(restPath .. "ui", sysPath .. "ui")
- fs.copy(restPath .. "Aset", usrPath .. "Admin/settings")
- fs.copy(restPath .. "startup", rootPath .. "startup")
- fs.copy(restPath .. "params", rootPath .. "params")
- fs.copy(restPath .. "luaIDE", prgPath .. "luaIDE")
- fs.copy(restPath .. "calcPlus", prgPath .. "calcPlus")
- fs.copy(restPath .. "ink", prgPath .. "ink")
- function register()
- os.loadAPI(funcPath .. "func")
- os.loadAPI(rootPath .. "params")
- _G.w, _G.h = term.getSize()
- if term.isColor() then
- _G.tbCol = params.tbColMain
- _G.tbxCol = params.tbxColMain
- _G.txCol = params.txColMain
- _G.bgCol = params.bgCol
- _G.stxCol = params.stxColMain
- else
- _G.tbCol = params.tbMain
- _G.tbxCol = params.tbMain
- _G.txCol = params.txMain
- _G.bgCol = params.bgCol
- _G.stxCol = params.stxMain
- end
- term.setBackgroundColor(bgCol)
- func.clear()
- local file = fs.open(regPath .. "usr", "r")
- local data = file.readAll()
- file.close()
- func.drawRect(1, 1, w, 1, tbCol, txCol)
- func.drawCenteredX("Enter your username:", 1, tbCol, txCol)
- local tUname = func.readCentered("> ")
- if string.find(data, tUname .. " = 1") or string.find(data, tUname .. " = 2") then
- func.clear()
- func.drawCenteredX("Username already in use!", h / 2, bgCol, tbxCol)
- sleep(1.5)
- func.clear()
- return false
- end
- func.clear()
- func.drawRect(1, 1, w, 1, tbCol)
- func.drawCenteredX("Enter your password:", 1, tbCol, txCol)
- local tPass = func.readCentered("> ", "*")
- func.clear()
- func.drawRect(1, 1, w, 1, tbCol)
- func.drawCenteredX("Re-enter your password:", 1, tbCol, txCol)
- local txPass = func.readCentered("> ", "*")
- if tPass ~= txPass then
- func.clear()
- func.drawCenteredX("Passwords did not match!", h / 2, bgCol, tbxCol)
- sleep(1.5)
- func.clear()
- return false
- end
- local AP = true
- func.clear()
- local file = fs.open(regPath .. "usr", "a")
- if AP == false then
- file.writeLine(tUname .. " = 1")
- elseif AP == true then
- file.writeLine(tUname .. " = 2")
- end
- file.writeLine(tUname .. "pass = " .. tPass)
- file.close()
- func.clear()
- fs.makeDir(usrPath .. tUname)
- local file = fs.open(usrPath .. tUname .. "/settings", "w")
- file.writeLine("bgCol = "..bgCol)
- file.writeLine("tbCol = " .. tbCol)
- file.writeLine("tbxCol = " .. tbxCol)
- file.writeLine("txCol = " .. txCol)
- file.writeLine("stxCol = " .. stxCol)
- file.writeLine("lockout = 30")
- file.close()
- return false
- end
- doit = true
- while doit do
- doit = register()
- end
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement