gluon-core: add default_hostname helper

This commit is contained in:
Matthias Schiffer 2018-03-17 11:44:33 +01:00
parent a5cb34bdc1
commit 9f86bf3155
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 5 additions and 1 deletions

View File

@ -15,7 +15,7 @@ local pretty_hostname = require 'pretty_hostname'
local system = uci:get_first('system', 'system')
pretty_hostname.set(uci, site.hostname_prefix('') .. util.node_id())
pretty_hostname.set(uci, util.default_hostname())
uci:set('system', system, 'timezone', site.timezone())
uci:save('system')

View File

@ -95,6 +95,10 @@ function node_id()
return string.gsub(sysconfig.primary_mac, ':', '')
end
function default_hostname()
return site.hostname_prefix('') .. node_id()
end
function domain_seed_bytes(key, length)
local ret = ''
local v = ''