Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DONT EDIT THIS OR UPDATE / CHECKUPDATE IS RUINED
- version = "1.0.0"
- -- From here its safe ;)
- term.clear()
- term.setCursorPos(1,1)
- print("Do you want to install Linux OS? ")
- ia = read()
- if ia == "yes" then
- -- Making database
- shell.run("mkdir", "db")
- shell.run("mkdir", "db/users")
- shell.run("mkdir", "db/users/level")
- shell.run("mkdir", "db/users/pass")
- shell.run("mkdir", "db/users/blocked")
- shell.run("mkdir", "db/sys")
- -- Asking admin data
- print("Admin username? ")
- ian = read()
- print("Admin password?")
- iap = read()
- -- Registering admin data
- file = io.open("db/users/pass/"..ian, "w")
- file : write(iap)
- file : close()
- file = io.open("db/users/level/".. ian, "w")
- file : write('6')
- file : close()
- -- File installation
- file = io.open("startup", "w")
- file : write([[
- sleep(.1)
- term.clear()
- term.setCursorPos(1,1)
- print("---[ Linux OS - Main menu ]--------------------")
- print("I")
- print("I [1] login")
- print("I [2] Register")
- print("I")
- print("-----------------------------------------------")
- stop = false
- while not stop do
- event, char = os.pullEvent()
- if event == "key" and char == 2 then
- shell.run("login")
- stop = true
- elseif event == "key" and char == 3 then
- shell.run("register")
- stop = true
- end
- end
- ]])
- file : close()
- file = io.open("login", "w")
- file : write([[
- function error()
- event = os.pullEvent()
- if event == "char" or event == "key" then
- shell.run("login")
- end
- end
- sleep(.1)
- term.clear()
- term.setCursorPos(1,1)
- print("---[ Linux OS - Login ]------------------------")
- print("I Enter at username: back, to go back")
- print("I Username:")
- print("I Password:")
- print("I Error:")
- print("I At a error press any key to continue")
- print("-----------------------------------------------")
- term.setCursorPos(13,3)
- lname = read()
- if lname == "back" then
- shell.run("startup")
- end
- term.setCursorPos(13,4)
- lpass = read()
- if fs.exists("db/users/pass/"..lname) then
- if fs.exists("db/users/blocked/"..lname) then
- term.setCursorPos(10,5)
- print("This user is blocked")
- error()
- else
- file = io.open("db/users/pass/"..lname, "r")
- gpass = file : read()
- file : close()
- if gpass == lpass then
- shell.run("loggedin")
- else
- term.setCursorPos(10,5)
- print("Password incorrect")
- error()
- end
- end
- else
- term.setCursorPos(10,5)
- print("Unknown username")
- error()
- end
- ]])
- file : close()
- file = io.open("register")
- file : write([[
- function acc()
- event = os.pullEvent()
- if event == "char" or event == "key" then
- shell.run("startup")
- end
- end
- function error()
- event = os.pullEvent()
- if event == "char" or event == "key" then
- shell.run("register")
- end
- end
- sleep(.1)
- term.clear()
- term.setCursorPos(1,1)
- print("---[ Linux OS - register ]---------------------")
- print("I Type back at the username to go back")
- print("I Username:")
- print("I Password:")
- print("I Error:")
- print("I At a error press any key to continue")
- print("-----------------------------------------------")
- term.setCursorPos(13,3)
- rname = read()
- if rname == "back" then
- shell.run("startup")
- end
- term.setCursorPos(13,4)
- rpass = read()
- if fs.exists("db/users/pass/"..rname) then
- term.setCursorPos(10,5)
- print("Username exists")
- error()
- else
- if fs.exists("db/users/blocked/"..rname) then
- term.setCursorPos(10,5)
- print("This user is blocked")
- error()
- else
- file = io.open("db/users/pass/"..rname, "w")
- file : write(rpass)
- file : close()
- file = io.open("db/users/level/"..rname, "w")
- file : write('1')
- file : close()
- term.setCursorPos(3,5)
- print("Account created: Press any key to continue")
- acc()
- end
- end
- ]])
- file : close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement