Commit 2fd75598 authored by Beniamino Galvani's avatar Beniamino Galvani

build: meson: uniform handling of rc managers

Handle all rc managers paths through the same code.
parent 36b0e461
......@@ -579,39 +579,41 @@ if enable_ovs
assert(jansson_dep.found(), 'jansson is needed for OpenVSwitch integration. Use -Dovs=false to disable it')
endif
# resolvconf and netconfig support
locations = get_option('resolvconf')
enable_resolvconf = (locations != ['no'])
if enable_resolvconf
resolvconf = find_program(locations, required: false)
enable_resolvconf = resolvconf.found()
if enable_resolvconf
config_h.set_quoted('RESOLVCONF_PATH', resolvconf.path())
# DNS resolv.conf managers
config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
resolv_conf_summary = ''
foreach prog_name : ['resolvconf', 'netconfig']
prog_path = get_option(prog_name)
prog_enable = (prog_path != 'no')
if prog_enable
if prog_path == ''
prog = find_program(prog_name,
'/usr/' + prog_name,
'/usr/sbin/' + prog_name,
'/usr/local/sbin' + prog_name,
required : false)
if prog.found()
prog_path = prog.path()
else
prog_enable = false
endif
endif
endif
endif
locations = get_option('netconfig')
enable_netconfig = (locations != ['no'])
if enable_netconfig
netconfig = find_program(locations, required: false)
enable_netconfig = netconfig.found()
if enable_netconfig
config_h.set_quoted('NETCONFIG_PATH', netconfig.path())
if prog_enable
config_h.set_quoted(prog_name.to_upper() + '_PATH', prog_path)
elif config_dns_rc_manager_default == prog_name
error(prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
endif
endif
config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
if config_dns_rc_manager_default == 'resolvconf' and not enable_resolvconf
error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
endif
if config_dns_rc_manager_default == 'netconfig' and not enable_netconfig
error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
endif
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
resolv_conf_summary += ' ' + prog_name + ': ' + prog_enable.to_string()
if prog_enable
resolv_conf_summary += ' ' + prog_path
endif
resolv_conf_summary += '\n'
endforeach
# external misc tools paths
default_paths = ['/sbin', '/usr/sbin']
......@@ -951,16 +953,7 @@ output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ')
output += ' ibft: ' + enable_ibft.to_string() + '\n'
output += ' ifcfg-rh: ' + enable_ifcfg_rh.to_string() + '\n'
output += ' ifupdown: ' + enable_ifupdown.to_string() + '\n'
output += '\nHandlers for /etc/resolv.conf:\n'
output += ' resolvconf: ' + enable_resolvconf.to_string()
if enable_resolvconf
output += ' ' + resolvconf.path()
endif
output += '\n'
output += ' netconfig: ' + enable_netconfig.to_string()
if enable_netconfig
output += ' ' + netconfig.path()
endif
output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary
output += '\n'
output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n'
output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary
......
......@@ -49,8 +49,8 @@ option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh
option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)')
# handlers for resolv.conf
option('resolvconf', type: 'array', value: ['resolvconf', '/sbin/resolvconf', '/usr/sbin/resolvconf', '/usr/local/sbin/resolvconf'], description: 'Enable resolvconf support')
option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr/sbin/netconfig', '/usr/local/sbin/netconfig'], description: 'Enable SUSE netconfig support')
option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support')
option('netconfig', type: 'string', value: '', description: 'Enable SUSE netconfig support')
option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting')
# dhcp clients
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment