Commit e860a2e0 authored by Beniamino Galvani's avatar Beniamino Galvani

build: meson: fix setting iptables/dnsmasq/dnssec-trigger paths

Handle the iptables, dnsmasq and dnssec-trigger paths in the same way
through common code.

The path set by user must be accepted as is, even if does not exist,
because this is a requirement for cross-compilation. When user does
not specify a path, search a predefined set of paths and fall back to
an hardcoded one.

(cherry picked from commit 220dea09)
parent 0e845fc2
......@@ -652,19 +652,34 @@ endif
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
# iptables path
config_h.set_quoted('IPTABLES_PATH', find_program(get_option('iptables')).path())
# dnsmasq path
config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path())
# dnssec-trigger-script path
dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false)
if dnssec_trigger_script.found()
config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path())
else
config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script'))
endif
# external misc tools paths
default_paths = ['/sbin', '/usr/sbin']
dnssec_ts_paths = ['/usr/local/libexec',
'/usr/local/lib',
'/usr/local/lib/dnssec-trigger',
'/usr/libexec',
'/usr/lib',
'/usr/lib/dnssec-trigger']
# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option
progs = [['iptables', default_paths, '/sbin/iptables'],
['dnsmasq', default_paths, ''],
['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script'), 'DNSSEC_TRIGGER_SCRIPT'],
]
foreach prog : progs
path = get_option(prog[0])
if path == ''
search_paths = [ prog[0] ]
foreach path : prog[1]
search_paths += (path + '/' + prog[0])
endforeach
exe = find_program(search_paths, required : false)
path = exe.found() ? exe.path() : prog[2]
endif
name = prog.length() > 3 ? prog[3] : (prog[0].to_upper() + '_PATH')
config_h.set_quoted(name, path)
endforeach
# system CA certificates path
system_ca_path = get_option('system_ca_path')
......
......@@ -7,9 +7,9 @@ option('dbus_ifaces_dir', type: 'string', value: '', description: 'where D-Bus i
option('dbus_sys_dir', type: 'string', value: '', description: 'where D-Bus system service directory is')
option('polkit_dir', type: 'string', value: '', description: 'where PolicyKit policy directory is')
option('kernel_firmware_dir', type: 'string', value: '/lib/firmware', description: 'where kernel firmware directory is (default is /lib/firmware)')
option('iptables', type: 'array', value: ['iptables', '/sbin/iptables', '/usr/sbin/iptables'], description: 'path to iptables')
option('dnsmasq', type: 'array', value: ['dnsmasq', '/sbin/dnsmasq', '/usr/sbin/dnsmasq'], description: 'path to dnsmasq')
option('dnssec_trigger', type: 'array', value: ['dnssec-trigger-script', '/usr/local/libexec/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger/dnssec-trigger-script', '/usr/libexec/dnssec-trigger-script', '/usr/lib/dnssec-trigger-script', '/usr/lib/dnssec-trigger/dnssec-trigger-script'], description: 'path to unbound dnssec-trigger-script')
option('iptables', type: 'string', value: '', description: 'path to iptables')
option('dnsmasq', type: 'string', value: '', description: 'path to dnsmasq')
option('dnssec_trigger', type: 'string', value: '', description: 'path to unbound dnssec-trigger-script')
# platform
option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string')
......
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