Merge branch 'master' of github.com:XeonSquared/PsychOS
This commit is contained in:
commit
5caeb70592
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
out/*
|
||||||
kernel.lua
|
kernel.lua
|
||||||
skernel.lua
|
skernel.lua
|
||||||
*.swp
|
*.swp
|
||||||
|
@ -15,12 +15,12 @@ modules/net/copper.lua
|
|||||||
modules/util/motd.lua
|
modules/util/motd.lua
|
||||||
modules/lib/readline.lua
|
modules/lib/readline.lua
|
||||||
modules/lib/shutil.lua
|
modules/lib/shutil.lua
|
||||||
modules/lib/sha256.lua
|
libwrap sha modules/lib/sha256.lua
|
||||||
modules/lib/userlib.lua
|
modules/lib/userlib.lua
|
||||||
modules/net/net-ext.lua
|
modules/net/net-ext.lua
|
||||||
modules/applications/login.lua
|
modules/applications/login.lua
|
||||||
modules/applications/luash.lua
|
|
||||||
modules/applications/genkernel.lua
|
modules/applications/genkernel.lua
|
||||||
|
fwrap luash exec/luash.lua
|
||||||
fwrap skex exec/skex2.lua
|
fwrap skex exec/skex2.lua
|
||||||
fwrap nshd exec/nshd.lua
|
fwrap nshd exec/nshd.lua
|
||||||
fwrap nsh exec/nsh.lua
|
fwrap nsh exec/nsh.lua
|
28
configs/headless.cfg
Executable file
28
configs/headless.cfg
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
modules/base/loadlin.lua
|
||||||
|
modules/debug/log.lua
|
||||||
|
modules/base/header.lua
|
||||||
|
modules/base/component.lua
|
||||||
|
modules/lib/fs.lua
|
||||||
|
modules/util/logflush.lua
|
||||||
|
modules/lib/buffer.lua
|
||||||
|
modules/lib/io.lua
|
||||||
|
modules/lib/print.lua
|
||||||
|
modules/lib/cdlib.lua
|
||||||
|
modules/lib/relib.lua
|
||||||
|
modules/net/copper.lua
|
||||||
|
modules/util/motd.lua
|
||||||
|
modules/lib/readline.lua
|
||||||
|
modules/lib/shutil.lua
|
||||||
|
modules/lib/sha256.lua
|
||||||
|
modules/lib/userlib.lua
|
||||||
|
modules/net/net-ext.lua
|
||||||
|
modules/applications/login.lua
|
||||||
|
fwrap luash exec/luash.lua
|
||||||
|
modules/applications/genkernel.lua
|
||||||
|
fwrap skex exec/skex2.lua
|
||||||
|
fwrap nshd exec/nshd.lua
|
||||||
|
fwrap nsh exec/nsh.lua
|
||||||
|
modules/util/fs-automount.lua
|
||||||
|
modules/setup.lua
|
||||||
|
modules/base/footer.lua
|
||||||
|
|
27
configs/minimal.cfg
Executable file
27
configs/minimal.cfg
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
modules/base/loadlin.lua
|
||||||
|
modules/debug/log.lua
|
||||||
|
modules/base/header.lua
|
||||||
|
modules/base/component.lua
|
||||||
|
modules/lib/fs.lua
|
||||||
|
modules/util/logflush.lua
|
||||||
|
modules/lib/buffer.lua
|
||||||
|
modules/lib/io.lua
|
||||||
|
modules/drivers/vt52.lua
|
||||||
|
modules/lib/print.lua
|
||||||
|
modules/drivers/kbd.lua
|
||||||
|
modules/lib/cdlib.lua
|
||||||
|
modules/lib/relib.lua
|
||||||
|
modules/net/copper.lua
|
||||||
|
modules/util/motd.lua
|
||||||
|
modules/lib/readline.lua
|
||||||
|
modules/lib/shutil.lua
|
||||||
|
modules/lib/sha256.lua
|
||||||
|
modules/lib/userlib.lua
|
||||||
|
modules/net/net-ext.lua
|
||||||
|
modules/applications/login.lua
|
||||||
|
fwrap luash exec/luash.lua
|
||||||
|
modules/applications/genkernel.lua
|
||||||
|
modules/util/fs-automount.lua
|
||||||
|
modules/setup.lua
|
||||||
|
modules/base/footer.lua
|
||||||
|
|
18
docs/fhs.md
Normal file
18
docs/fhs.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
## Filesystem Hierarchy Standard
|
||||||
|
PsychOS is not a UNIX system, nor does it try to be. It doesn't have a 'real' VFS and doesn't have a devfs. As such, the filesystem is arranged differently.
|
||||||
|
|
||||||
|
### Top level filesystems.
|
||||||
|
Filesystems devices are represented as top-level directories, eg /boot, /tmp, /fs01.
|
||||||
|
The mount points are strings, and can be of arbitrary length. However, it is recommended to keep them under 20 characters, and to not have spaces, or special characters in them.
|
||||||
|
A device can be mounted multiple times under multiple names.
|
||||||
|
|
||||||
|
### /boot
|
||||||
|
/boot is the device the system booted from, and may be the same as /tmp under some circumstances. It contains all the special directories needed for the system to function.
|
||||||
|
#### /boot/exec
|
||||||
|
exec contains executable programs and utilities, generally separate from the kernel.
|
||||||
|
#### /boot/lib
|
||||||
|
lib contains all the libraries used by the system.
|
||||||
|
#### /boot/doc
|
||||||
|
doc contains the documentation, though it may not exist if the documentation isn't neccesary.
|
||||||
|
#### /boot/sys
|
||||||
|
sys contains miscellaneous system files like the user database and autorun scripts.
|
@ -23,3 +23,4 @@ PsychOS is a single-user cooperative multitasking operating system for OpenCompu
|
|||||||
- User guide (WIP)
|
- User guide (WIP)
|
||||||
- [Building PsychOS](building.html)
|
- [Building PsychOS](building.html)
|
||||||
- [API documentation](api.html)
|
- [API documentation](api.html)
|
||||||
|
- [Filesystem layout](fhs.html)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
function luash(si)
|
local tA = {...}
|
||||||
|
local si = tA[1]
|
||||||
spawn("lua shell",function()
|
spawn("lua shell",function()
|
||||||
|
_ENV = shutil.genenv()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
log(login())
|
log(login())
|
||||||
print("\f"..MOTD)
|
print("\f"..MOTD)
|
||||||
@ -37,7 +39,7 @@ spawn("lua shell",function()
|
|||||||
if inp:sub(1,1) == "=" then
|
if inp:sub(1,1) == "=" then
|
||||||
inp="return "..inp:sub(2)
|
inp="return "..inp:sub(2)
|
||||||
end
|
end
|
||||||
local r={pcall(load(inp))}
|
local r={pcall(load(inp,_ENV))}
|
||||||
if r[1] == true then
|
if r[1] == true then
|
||||||
table.remove(r,1)
|
table.remove(r,1)
|
||||||
end
|
end
|
||||||
@ -45,4 +47,3 @@ spawn("lua shell",function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,{sI=si})
|
end,{sI=si})
|
||||||
end
|
|
@ -1,3 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
./genkernel.lua build.cfg "$(git rev-parse --short HEAD)" > kernel.lua
|
mkdir -p out/
|
||||||
lua strip.lua kernel.lua skernel.lua
|
for f in `dir -d configs/*`; do
|
||||||
|
kn=$(echo $f | cut -f 1 -d '.' | cut -f 2 -d "/")
|
||||||
|
./genkernel.lua $f "$(git rev-parse --short HEAD)" > out/$kn.lua
|
||||||
|
lua strip.lua out/$kn.lua out/s$kn.lua
|
||||||
|
done
|
||||||
|
@ -22,6 +22,10 @@ function genkernel(modlistf,kname)
|
|||||||
nk=nk.."function "..tw[2].."(...)\n"
|
nk=nk.."function "..tw[2].."(...)\n"
|
||||||
apfile(tw[3])
|
apfile(tw[3])
|
||||||
nk=nk.."\nend\n"
|
nk=nk.."\nend\n"
|
||||||
|
elseif tw[1] == "libwrap" then
|
||||||
|
nk=nk.."function "..tw[2].."(...)\n"
|
||||||
|
apfile(tw[3])
|
||||||
|
nk=nk.."\nend\n_G."..tw[2].." = "..tw[2].."()\n"
|
||||||
elseif tw[1] == "include" then
|
elseif tw[1] == "include" then
|
||||||
apfile(tw[2])
|
apfile(tw[2])
|
||||||
else
|
else
|
||||||
|
@ -53,7 +53,7 @@ function tty(gA,sA,sI,fg,bg)
|
|||||||
elseif c == "\r" then cx=1
|
elseif c == "\r" then cx=1
|
||||||
elseif c == "\f" then cx=1 cy=1 gP.fill(1, 1, sx, sy, " ")
|
elseif c == "\f" then cx=1 cy=1 gP.fill(1, 1, sx, sy, " ")
|
||||||
elseif c == "\t" then cx=(cx+8-((cx+8)%8))+1
|
elseif c == "\t" then cx=(cx+8-((cx+8)%8))+1
|
||||||
elseif c == "\127" then cx=cx-1 gP.set(cx,cy," ")
|
elseif c == "\127" then cx=cx-1 gP.set(cx,cy,(" "):rep(2))
|
||||||
else gP.set(cx,cy,c) cx=cx+1
|
else gP.set(cx,cy,c) cx=cx+1
|
||||||
end
|
end
|
||||||
end cv()
|
end cv()
|
||||||
|
@ -1,35 +1,4 @@
|
|||||||
_G.buffer = {}
|
_G.buffer = {}
|
||||||
--[[function buffer.create(w,c) -- worker, close
|
|
||||||
local t={}
|
|
||||||
t.b=""
|
|
||||||
function t.w(s,d)
|
|
||||||
s.b=s.b..tostring(d)
|
|
||||||
end
|
|
||||||
t.write = t.w
|
|
||||||
function t.r(s,l)
|
|
||||||
if type(l) == "number" then
|
|
||||||
local ns,bs=s.b:sub(1,l+1),s.b:sub(l+2)
|
|
||||||
s.b=bs
|
|
||||||
return ns
|
|
||||||
elseif type(l) == "string" then
|
|
||||||
local oS=s.b
|
|
||||||
if l == "*a" then
|
|
||||||
s.b=""
|
|
||||||
return oS
|
|
||||||
elseif l == "*l" then
|
|
||||||
S=s.b:find("\n") or #s.b
|
|
||||||
s.b=s.b:sub(S+1)
|
|
||||||
rS = oS:sub(1,S-1)
|
|
||||||
if rS:len() < 1 then return nil end
|
|
||||||
return rS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
t.read = t.r
|
|
||||||
t.close = c
|
|
||||||
w(t)
|
|
||||||
return t
|
|
||||||
end]]--
|
|
||||||
function buffer.ucreate()
|
function buffer.ucreate()
|
||||||
local b = {}
|
local b = {}
|
||||||
b.b,b.s = "","open"
|
b.b,b.s = "","open"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua
|
-- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua
|
||||||
--
|
--
|
||||||
-- Data card support added by https://github.com/SuPeRMiNoR2
|
-- Data card support added by https://github.com/SuPeRMiNoR2
|
||||||
_G.sha = {}
|
sha = {}
|
||||||
if component then
|
if component then
|
||||||
if component.data and not component.ocemu then
|
if component.data and not component.ocemu then
|
||||||
shamode = "hardware"
|
shamode = "hardware"
|
||||||
@ -216,3 +216,4 @@ local function datac256(data)
|
|||||||
return toHex(datac.sha256(data))
|
return toHex(datac.sha256(data))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return sha
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
cd=fs.cd
|
local shutil = {}
|
||||||
rm=fs.rm
|
shutil.cd=fs.cd
|
||||||
mkdir=fs.mkdir
|
shutil.rm=fs.rm
|
||||||
cp=fs.cp
|
shutil.mkdir=fs.mkdir
|
||||||
mv=fs.mv
|
shutil.cp=fs.cp
|
||||||
function ls(p)
|
shutil.mv=fs.mv
|
||||||
|
function shutil.ls(p)
|
||||||
for k,v in ipairs(fs.list(p)) do print(v) end
|
for k,v in ipairs(fs.list(p)) do print(v) end
|
||||||
end
|
end
|
||||||
function cat(p)
|
function shutil.cat(p)
|
||||||
local f=io.open(p)
|
local f=io.open(p)
|
||||||
print(f:read("*a"))
|
print(f:read("*a"))
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
function ps(f)
|
function shutil.ps(f)
|
||||||
local f=f or ""
|
local f=f or ""
|
||||||
print("PID\tName")
|
print("PID\tName")
|
||||||
for k,v in pairs(os.tasks()) do
|
for k,v in pairs(os.tasks()) do
|
||||||
@ -20,13 +21,22 @@ function ps(f)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function mem()
|
function shutil.mem()
|
||||||
print(" \tTotal\tFree\tUsed")
|
print(" \tTotal\tFree\tUsed")
|
||||||
io.write("Mem\t")
|
io.write("Mem\t")
|
||||||
io.write(tostring(math.floor(computer.totalMemory()/1024)).."K\t")
|
io.write(tostring(math.floor(computer.totalMemory()/1024)).."K\t")
|
||||||
io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t")
|
io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t")
|
||||||
print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t")
|
print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t")
|
||||||
end
|
end
|
||||||
|
function shutil.genenv()
|
||||||
|
local et = os.genenv()
|
||||||
|
for k,v in pairs(shutil) do
|
||||||
|
if k ~= "genenv" then
|
||||||
|
et[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return et
|
||||||
|
end
|
||||||
function loadfile(fn)
|
function loadfile(fn)
|
||||||
local f=io.open(fn,"rb")
|
local f=io.open(fn,"rb")
|
||||||
local S=f:read("*a")
|
local S=f:read("*a")
|
||||||
|
@ -1 +1 @@
|
|||||||
run("/boot/autorun.lua")
|
run("/boot/sys/init.lua")
|
||||||
|
@ -31,7 +31,7 @@ for k,v in ipairs(replacements) do
|
|||||||
no=no+1
|
no=no+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("\nBefore: "..sl.."\nAfter: "..tostring(ss:len()).."\n"..tostring(no).." optimisations made.\n")
|
print("\nBefore: "..sl.."\nAfter: "..tostring(ss:len()).."\nDelta: "..tostring(sl-ss:len()))
|
||||||
|
|
||||||
f=io.open(tA[2],"wb")
|
f=io.open(tA[2],"wb")
|
||||||
f:write(ss)
|
f:write(ss)
|
||||||
|
Loading…
Reference in New Issue
Block a user