gluon-core: add default_hostname helper
This commit is contained in:
		
							parent
							
								
									a5cb34bdc1
								
							
						
					
					
						commit
						9f86bf3155
					
				@ -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')
 | 
			
		||||
 | 
			
		||||
@ -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 = ''
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user