pretty-hostname: instantly apply hostname

This makes it work like the CLI
This commit is contained in:
Maciej Krüger 2022-01-20 11:05:35 +01:00
parent 52d7ac4aea
commit 5bca0364d0
No known key found for this signature in database
GPG Key ID: 0D948CE19CF49C5F
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,10 @@ function M.set(uci, pretty_hostname)
uci:set('system', system, 'pretty_hostname', pretty_hostname)
end
local kernel = assert(io.open('/proc/sys/kernel/hostname', 'w'))
kernel:write(hostname)
kernel:close()
uci:set('system', system, 'hostname', hostname)
end