removed the requirement for access to the computer API, used the system-wide hostname if available

This commit is contained in:
Izaya 2018-04-25 02:50:35 +10:00
parent 1c8f5f75bf
commit 6a5b711172
1 changed files with 7 additions and 14 deletions

View File

@ -1,11 +1,11 @@
-- KittenOS NEO Wrapper for OpenOS Minitel
-- Take my word for it it works p. well
local rcomputer = neo.requireAccess("k.computer","pushing packets")
--local rcomputer = neo.requireAccess("k.computer","pushing packets")
neo.requireAccess("s.h.modem_message","pulling packets")
local processes = {}
local hooks = {}
local computer = {["uptime"]=rcomputer.uptime,["address"]=rcomputer.address} -- wrap computer so the OpenOS code more or less works
local computer = {["uptime"]=os.uptime,["address"]=os.address} -- wrap computer so the OpenOS code more or less works
local event = {}
function event.timer()
end
@ -88,19 +88,12 @@ local function dprint(...)
end
end
-- this stuff doesn't work on KittenOS, I'll need to implement a better hostname getting thing than the computer address
--[[
local f=io.open("/etc/hostname","rb")
if f then
hostname = f:read()
f:close()
local globals = neo.requestAccess("x.neo.pub.globals") -- KittenOS standard hostname stuff
if globals then
hostname = globals.getSetting("hostname") or hostname
globals.setSetting("hostname",hostname)
end
print("Hostname: "..hostname)
if listener then return end
for a,t in component.list("modem") do
modems[#modems+1] = component.proxy(a)
end
]]--
for p in neo.requireAccess("c.modem","networking").list() do -- fun stuff for KittenOS
dprint(p.address)
modems[p.address] = p