Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- drive = "disk"
- os.loadAPI(drive.."/lib/libfs")
- os.loadAPI(drive.."/lib/text/textlib")
- os.loadAPI(drive.."/lib/libshell")
- fs.makeDir("/etc")
- file = fs.open("/etc/fstab", "w")
- file.write("{[\"root\"]={\"/\", \"/bin\"},}")
- file.close()
- os.loadAPI("/disk/lib/libuser")
- libuser.setUser("root")
- function draw()
- term.setBackgroundColor(colors.blue)
- term.clear()
- h, w = term.getSize()
- term.setCursorPos(8, 5)
- term.setBackgroundColor(colors.black)
- for i=9, 44 do
- term.setCursorPos(i, 17)
- term.write(" ")
- end
- term.setBackgroundColor(colors.lightGray)
- for b=4, 16 do
- for i=8, 43 do
- term.setCursorPos(i, b)
- term.write(" ")
- end
- end
- term.setBackgroundColor(colors.black)
- for i=5, 17 do
- term.setCursorPos(44, i)
- term.write(" ")
- end
- end
- function drawwind()
- draw()
- term.setCursorPos(9, 5)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightGray)
- end
- for i, k in pairs(fs.list("/disk")) do
- if not fs.exists("/"..k) then
- fs.copy("/disk/"..k, "/"..k)
- else
- fs.delete("/"..k)
- fs.copy("/disk/"..k, "/"..k)
- end
- end
- fs.delete("/startup")
- fs.move("/startlinux", "/startup")
- usn = ""
- function userwind()
- drawwind()
- term.write("Inserire il nome utente")
- term.setCursorPos(9, 7)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- usn = ""
- while true do
- term.setCursorPos(9, 7)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.white)
- for i=9, 40 do
- term.setCursorPos(i, 7)
- term.write(" ")
- end
- term.setCursorPos(9, 7)
- term.write(usn)
- term.setBackgroundColor(colors.black)
- term.setCursorBlink(true)
- _, c = os.pullEvent()
- if _ == "char" and #usn < 31 then
- usn = usn..c
- elseif _ == "key" then
- if c == keys.backspace then
- usn = string.sub(usn, 1, #usn-1)
- elseif c == keys.enter and usn ~= "" then
- break
- end
- end
- end
- end
- userwind()
- libshell.run("/bin/useradd "..usn)
- pswd = ""
- function passwdwind()
- drawwind()
- term.write("Inserire la password")
- term.setCursorPos(9, 7)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- pswd = ""
- while true do
- term.setCursorPos(9, 7)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.white)
- for i=9, 40 do
- term.setCursorPos(i, 7)
- term.write(" ")
- end
- term.setCursorPos(9, 7)
- for i=1, #pswd do
- term.write("*")
- end
- term.setBackgroundColor(colors.black)
- term.setCursorBlink(true)
- _, c = os.pullEvent()
- if _ == "char" and #usn < 31 then
- usn = usn..c
- elseif _ == "key" then
- if c == keys.backspace then
- usn = string.sub(usn, 1, #pswd-1)
- elseif c == keys.enter and pswd ~= "" then
- break
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment