init now sets the hostname, if possible

This commit is contained in:
Izaya 2019-11-19 21:38:22 +11:00
parent 1f66ef4f1c
commit b3aa15b580
1 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,14 @@ end
os.setenv("PWD","/boot")
io.input("/dev/null")
io.output("/dev/syslog")
local f = io.open("/boot/cfg/hostname","rb")
local hostname = computer.address():sub(1,8)
if f then
hostname = f:read("*l")
f:close()
end
os.setenv("HOSTNAME",hostname)
syslog(string.format("Hostname set to %s",hostname))
local pids = {}
local function loadlist()
local f = io.open("/boot/cfg/init.txt","rb")