Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- _G.os.pullEvent = function(...)
- local ret = {kernel.yield(...)}
- if string.lower(ret[1]) == "terminate" then
- error("Terminated", 0)
- end
- return table.unpack(ret)
- end
- _G.fs.isReadOnly = function(...) return not kernel.hasread(...) end
- local cont
- local rPath
- local CC = kernel.getpwnam("CC").pw_uid
- local tDir
- if fs.exists("/etc/os-release") then
- local file = fs.open("/etc/os-release","r")
- cont = file.readAll()
- file.close()
- else
- cont = " N/R "
- end
- cont = string.sub(cont,0,6)
- _G.version = cont
- _G.os.version = function()
- return "CraftOS | Vorbani: ".._G.version
- end
- if not args[1] then
- return printError("Usage: launch <target dir> [rom path]")
- else
- tDir = args[1]
- end
- if not args[2] then
- rPath = "/CraftOS/rom"
- else
- rPath = args[2]
- end
- _G.os.run = function(env,path,...)
- if fs.exists(path) then
- local file = fs.open(path,"r")
- local cont = file.readAll()
- file.close()
- return load(cont,path,nil,env)(...)
- else
- return printError("Please input a valid path")
- end
- end
- if not fs.exists(tDir.."/dev") then
- fs.makeDir(tDir.."/dev")
- end
- kernel.mount("dattach",tDir.."/dev")
- if not fs.exists(tDir.."/proc") then
- fs.makeDir(tDir.."/proc")
- end
- kernel.mount("proc",tDir.."/proc")
- if not fs.exists(tDir.."/rom") then
- fs.makeDir(tDir.."/rom")
- end
- kernel.mount(rPath,tDir.."/rom",true)
- term.clear()
- term.setCursorPos(1,1)
- kernel.chroot(tDir)
- kernel.setuid(CC)
- os.run({},"/rom/programs/shell")
Advertisement
Add Comment
Please, Sign In to add comment