Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The oc-cc-kernel installer --
- -- GitGet is made by Apemanzilla --
- local user = ""
- local password = ":(){:|:&}"
- local confirmedPassword = "HSA*(*)J" -- Placeholder
- local gitget = "W5ZkVYSi"
- local baseURL = "https://raw.githubusercontent.com/"
- local ocefi = baseURL .. "ocawesome101/ocbios/master/uefi.lua"
- local ccbios = false
- if os.version():sub(1,7) == "CC-BIOS" then ccbios = true end
- local filesToRemove = {"json","README.md","DOCS.md"}
- local function exec(code, arg1, arg2)
- local d = http.get("https://pastebin.com/raw/" .. code)
- local e = loadstring(d.readAll())
- d.close()
- local M = {}
- M.shell = {}
- M.shell.resolve = function(path)
- return path
- end
- M.http = http
- M.os = os
- M.fs = fs
- M.string = string
- M.table = table
- M.print = print
- setmetatable(M, {__index = _G})
- setfenv(e, M)
- e(arg1, arg2)
- end
- print("Welcome to the OC-CC-Kernel installer.")
- sleep(0.2)
- write("Install OC-CC-Kernel to the main hard drive? [y/n]: ")
- local inst = read():lower()
- if inst == "y" then
- print("The base system will now be downloaded and set up.")
- exec(gitget, "ocawesome101", "oc-cc-kernel")
- for i=1, #filesToRemove, 1 do
- if fs.exists(filesToRemove[i]) then
- fs.delete(filesToRemove[i])
- end
- end
- if not ccbios then
- print("CC-BIOS not detected-- downloading EFI system required to boot oc-cc-kernel")
- shell.run("wget", ocefi, "startup.lua")
- else
- print("CC-BIOS detected-- skipping download of startup.lua")
- end
- print("This installer will now perform some basic setup.")
- print("Usernames and passwords cannot contain spaces.")
- while true do
- local continue = false
- write("Please input a username (i.e. john): ")
- user = read()
- for i=1, #user, 1 do
- if user:sub(i,i) == " " then
- continue = true
- end
- end
- if not continue then
- break
- end
- print("Username cannot contain spaces")
- end
- while true do
- local continue = false
- write("Please input a password: ")
- password = read("*")
- write("Confirm password: ")
- confirmedPassword = read("*")
- if password == confirmedPassword then
- for i=1, #password, 1 do
- if password:sub(i,i) == " " then
- continue = true
- end
- end
- else
- print("Passwords do not match")
- continue = true
- end
- if not continue then
- break
- end
- print("Password cannot contain spaces")
- end
- local userdata = "return {\n \"" .. user .. "\"\n}"
- local pwddata = "return {\n \"" .. password .. "\"\n}"
- print("Saving username and password; creating user")
- local h = fs.open("/etc/userdata/users.lua", "w")
- h.write(userdata)
- h.close()
- local h = fs.open("/etc/userdata/passwords.lua", "w")
- h.write(pwddata)
- h.close()
- fs.makeDir("/home/" .. user)
- fs.makeDir("/root")
- print("Now that a user has been set up, your system can be restarted.")
- write("Restart now? [y/n]: ")
- if read() == ("y" or "Y") then
- print("Restarting.")
- sleep(0.2)
- os.reboot()
- else
- print("Exiting.")
- os.sleep(0.2)
- end
- else
- print("Not installing OC-CC-Kernel. Have a nice day.")
- sleep(1)
- os.reboot()
- end
Add Comment
Please, Sign In to add comment