1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-26 03:48:06 +11:00

Compare commits

..

3 Commits

6 changed files with 59 additions and 2 deletions

36
Embedded/dlfs.lua Normal file
View File

@ -0,0 +1,36 @@
c=""
do
local host,port,FD=component.invoke(component.list("eeprom")(),"getData"):match("(.+)\n(.+)\n(.+)")
port=tonumber(port)
local fs,dirlist,filelist=component.proxy(computer.tmpAddress()),{FD},{}
for _,dir in pairs(dirlist) do
local content,ftype = fget(host,dir,port)
if ftype == "d" then
for line in content:gmatch("[^\n]+") do
if line:sub(-1) == "/" then
dirlist[#dirlist+1] = dir..line
else
filelist[#filelist+1] = dir..line
end
end
end
end
for _,dir in pairs(dirlist) do
dir=dir:sub(#dirlist[1])
fs.makeDirectory(dir)
end
for _,file in pairs(filelist) do
local filename=file:sub(#dirlist[1]+1)
local content,ftype = fget(host,file,port)
f=fs.open(filename,"wb")
fs.write(f,content)
fs.close(f)
end
local fh,b = fs.open("boot.lua"),""
repeat
b=fs.read(fh,4096) or ""
c=c..b
until b == ""
end
computer.getBootAddress = computer.tmpAddress
load(c)()

14
Embedded/dlfs.lua.min Normal file
View File

@ -0,0 +1,14 @@
{
{"init","I"},
{"dirlist","DL"},
{"filelist","FL"},
{"host","H"},
{"port","P"},
{"line","L"},
{"ftype","F"},
{"content","K"},
{"filename","FN"},
{"table.remove","TR"},
{"dir","CD"},
{"file","CF"}
,}

View File

@ -2,9 +2,9 @@ function fget(A,P,V)
local b,tb,s="","",net.open(A,V or 70) local b,tb,s="","",net.open(A,V or 70)
s:w("t"..P.."\n") s:w("t"..P.."\n")
repeat repeat
UC.pullSignal() computer.pullSignal()
tb=s:r(2048) tb=s:r(2048)
b=b..tb b=b..tb
until tb == "" and s.s == "c" until tb == "" and s.s == "c"
return b:sub(2) return b:sub(2),b:sub(1,1)
end end

View File

@ -9,6 +9,8 @@ echo ufs.lua
lua minify.lua ufs.lua mini-ufs.lua lua minify.lua ufs.lua mini-ufs.lua
echo init-wrapper.lua echo init-wrapper.lua
lua minify.lua init-wrapper.lua mini-init-wrapper.lua lua minify.lua init-wrapper.lua mini-init-wrapper.lua
echo dlfs.lua
lua minify.lua dlfs.lua mini-dlfs.lua
echo microtel-3.lua echo microtel-3.lua
lua minify.lua microtel/microtel-3.lua microtel/mini-microtel-3.lua lua minify.lua microtel/microtel-3.lua microtel/mini-microtel-3.lua
echo microtel-4.lua echo microtel-4.lua
@ -27,3 +29,6 @@ cat microtel/mini-microtel-{3,4,5-core,5-open}.lua mini-vt100.lua mini-minipromp
lua minify.lua nminiprompt.lua mini-nminiprompt.lua lua minify.lua nminiprompt.lua mini-nminiprompt.lua
echo -e "GC,UC=component,computer" | cat - mini-nminiprompt.lua > mini-fnminiprompt.lua echo -e "GC,UC=component,computer" | cat - mini-nminiprompt.lua > mini-fnminiprompt.lua
mv mini-fnminiprompt.lua mini-nminiprompt.lua mv mini-fnminiprompt.lua mini-nminiprompt.lua
cat microtel/mini-microtel-{3,4,5-core,5-open}.lua mini-fget.lua mini-dlfs.lua > mini-nbcore.lua
cat microtel/microtel-{3,4,5-core,5-open}.lua fget.lua dlfs.lua > nbcore.lua

View File

@ -2,6 +2,7 @@ local net = require "minitel"
local syslog = require "syslog" local syslog = require "syslog"
local fs = require "filesystem" local fs = require "filesystem"
local event = require "event" local event = require "event"
local serial = require "serialization"
local coro = {} -- table of coroutines, one per socket local coro = {} -- table of coroutines, one per socket
local cfg = {} local cfg = {}

View File

@ -74,6 +74,7 @@ if firstrun then -- if first run, quit now
cfg.route = false cfg.route = false
end end
os.execute("rc minitel enable") os.execute("rc minitel enable")
os.execute("rc minitel start")
writecfg() writecfg()
print("Your hostname is "..hostname..".") print("Your hostname is "..hostname..".")
print("Run mtcfg to configure advanced settings.") print("Run mtcfg to configure advanced settings.")