Skip to content
Snippets Groups Projects
Unverified Commit 9f86bf31 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-core: add default_hostname helper

parent a5cb34bd
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ local pretty_hostname = require 'pretty_hostname' ...@@ -15,7 +15,7 @@ local pretty_hostname = require 'pretty_hostname'
local system = uci:get_first('system', 'system') 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:set('system', system, 'timezone', site.timezone())
uci:save('system') uci:save('system')
...@@ -95,6 +95,10 @@ function node_id() ...@@ -95,6 +95,10 @@ function node_id()
return string.gsub(sysconfig.primary_mac, ':', '') return string.gsub(sysconfig.primary_mac, ':', '')
end end
function default_hostname()
return site.hostname_prefix('') .. node_id()
end
function domain_seed_bytes(key, length) function domain_seed_bytes(key, length)
local ret = '' local ret = ''
local v = '' local v = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment