Compare commits

..

2 Commits

5 changed files with 58 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
/build /build
apidoc.md apidoc.md
apidoc.html apidoc.html
psychos/
psychos.cpio
psychos-tarbomb.cpio

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cp ../OC-Minitel/minitel.lua service/minitel.lua
mkdir build mkdir build
cd module cd module
cat sched.lua syslog.lua vt100.lua fs.lua iofs.lua loadfile.lua vt-task.lua io.lua createterms.lua init.lua > ../build/psychos.lua cat sched.lua syslog.lua vt100.lua fs.lua iofs.lua loadfile.lua vt-task.lua io.lua createterms.lua init.lua > ../build/psychos.lua

View File

@ -1,7 +1,7 @@
local tArgs = {...} local tArgs = {...}
local output = tArgs[2] local output = table.remove(tArgs,#tArgs)
local of = io.open(output,"wb") local of = io.open(output,"wb")
local files, dirs = {}, {tArgs[1]} local files, dirs = {}, {tArgs[1] or "."}
local function cint(n,l) local function cint(n,l)
local t={} local t={}

51
exec/unarchive.lua Normal file
View File

@ -0,0 +1,51 @@
local tArgs = {...}
local function toint(s)
s=s or ""
local n = 0
local i = 1
while true do
local p = s:sub(i,i)
if p == "" then break end
local b = string.byte(p)
n = n << 8
n = n | b
i=i+1
end
return n
end
local fi = io.open(tArgs[1])
while true do
local nlen = toint(fi:read(2))
if nlen == 0 then
break
end
local name = fi:read(nlen)
local fsize = toint(fi:read(2))
io.write(string.format("%s: %d... ",name,fsize))
if not tArgs[2] then
local dir = name:match("(.+)/.*%.?.+")
if (dir) then
fs.makeDirectory(dir)
end
local f = io.open(name,"wb")
local rsize,buf = fsize, ""
if f then
repeat
buf = fi:read(math.min(rsize,1024))
f:write(buf)
rsize = rsize - buf:len()
until rsize <= 1
f:close()
end
else
local rsize = fsize
repeat
buf = fi:read(math.min(rsize,1024))
rsize = rsize - buf:len()
until rsize <= 1
end
print(fsize)
end
fi:close()

View File

@ -4,6 +4,6 @@ mkdir psychos
cp -r exec/ lib/ service/ psychos/ cp -r exec/ lib/ service/ psychos/
cp build/psychos.lua psychos/init.lua cp build/psychos.lua psychos/init.lua
cp default-init.txt psychos/init.txt cp default-init.txt psychos/init.txt
tree -if psychos/ | cpio -oHbin > psychos.cpio find psychos/ | cpio -oHbin > psychos.cpio
cd psychos cd psychos
tree -if | cpio -oHbin > ../psychos-tarbomb.cpio find | cpio -oHbin > ../psychos-tarbomb.cpio