Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Lua by HAXX0RP0N3 ( 14 years ago )
sys/lib/core
function DerpyOS_System_GetName()
shell.run("/sys/etc/config")
return DerpyOS_Config_SystemName
end
sys/lib/display
function DerpyOS_Display_Clear()
term.clear()
term.setCursorPos(1,1)
end
function DerpyOA_Display_ShowBanner()
tx, ty = term.getSize()
ts = (tx - 27) / 2
space = ""
while ts > 0 do space = space .. " "; ts = ts - 1; end
print(space.."
print(space.." |
print(space.." |_/ (/_ | |_) \\/ \\_/ __) ")
print(space.." | ")
print(space.." Version 0.1 : by akiwiguy ")
print(space.."---------------------------")
end
sys/lib/rc
shell.run("/sys/lib/core")
shell.run("/sys/lib/display")
DerpyOS_Display_Clear()
DerpyOS_Display_ShowBanner()
shell.run("/sys/etc/config")
t = DerpyOS_Config_Modules()
for i=1,# t do
term.write("Loading module " .. t[i])
shell.run("/sys/lib/" .. t[i])
x, y = term.getCursorPos()
tx, ty = term.getSize()
term.setCursorPos(tx - 6, y)
print("[ OK ]")
end
if DerpyOS_Shell_Main == nil then
print(":: Shell not loader, dropping to debug")
shell.run("shell")
else
DerpyOS_Shell_Main()
end
sys/lib/shell
function DerpyOS_Shell_Main()
while true do
term.write(DerpyOS_Shell_ReadPS1())
l8ine = io.read()
if line == "!break" then
break
elseif line == "reboot" then
shell.run("reboot")
elseif line == "shutdown" then
shell.run("shutdown")
else
print("shell: invalid command")
end
end
end
function DerpyOS_Shell_ReadPS1()
handle = fs.open(DerpyOS_User_GetUserProfileDir() .. "/config/shellPS1", "r")
prompt = handle.readLine()
handle.close()
prompt = prompt:gsub(" ::u", DerpyOS_User_GetUsername()
prompt = prompt:gsub("::l", Derpy_System_GetName())
return prompt
end
/sys/lib/user
function DerpyOS_User_GetUsername()
return "user"
end
function DerpyOS_User_GetUserProfileDir()
return "/user/" .. DerpyOS_User_GetuserName() .. "/"
end
sys/etc/config
-- DerpyOS Global Configuration --
-- Name of computer --
DerpyOS_Config_Systemname = "name"
-- modules to load on bootup --
DerpyOS_Config_Modules = { "user", "shell" }
Revise this Paste