diff options
author | Jan Vaclav <jvaclav@redhat.com> | 2023-07-10 11:05:42 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-07-11 17:06:19 +0200 |
commit | 9a5c7c7228ce7ef389918113c89dec27ec9c84cb (patch) | |
tree | 14cdd0e64f706136205dcd8109f69153bfe4155d | |
parent | 5b8fdd25ab431dd1318eff00e725448f7c699a30 (diff) |
build: make modprobe path configurable
Extracts the hardcoded modprobe path used in `src/libnm-platform/nm-platform-utils.c` to the configurable MODPROBE_PATH macro
Merge request: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1689
Closes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1257
-rw-r--r-- | config.h.meson | 3 | ||||
-rw-r--r-- | configure.ac | 14 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rw-r--r-- | src/libnm-platform/nm-platform-utils.c | 2 |
5 files changed, 21 insertions, 1 deletions
diff --git a/config.h.meson b/config.h.meson index a08ce2e0ad..f6485e6915 100644 --- a/config.h.meson +++ b/config.h.meson @@ -13,6 +13,9 @@ /* Define to path of dnsmasq binary */ #mesondefine DNSMASQ_PATH +/* Define to path of modprobe binary */ +#mesondefine MODPROBE_PATH + /* Gettext package */ #mesondefine GETTEXT_PACKAGE diff --git a/configure.ac b/configure.ac index d007559849..66be7ff2c3 100644 --- a/configure.ac +++ b/configure.ac @@ -1008,6 +1008,19 @@ fi AC_DEFINE_UNQUOTED(NFT_PATH, "$NFT_PATH", [Define to path of nft binary]) AC_SUBST(NFT_PATH) +AC_ARG_WITH(modprobe, + AS_HELP_STRING([--with-modprobe=/sbin/modprobe], [path to modprobe])) +if test "x${with_modprobe}" = x; then + AC_PATH_PROG(MODPROBE_PATH, modprobe, [], $PATH:/sbin:/usr/sbin) + if test "x$MODPROBE_PATH" = x; then + MODPROBE_PATH='/sbin/modprobe' + fi +else + MODPROBE_PATH="$with_modprobe" +fi +AC_DEFINE_UNQUOTED(MODPROBE_PATH, "$MODPROBE_PATH", [Define to path of modprobe binary]) +AC_SUBST(MODPROBE_PATH) + AC_ARG_WITH(dnsmasq, AS_HELP_STRING([--with-dnsmasq=/path/to/dnsmasq], [path to dnsmasq])) if test "x${with_dnsmasq}" = x; then @@ -1422,6 +1435,7 @@ echo " iwd: $ac_with_iwd" echo " jansson: $have_jansson${JANSSON_SONAME:+ (soname: $JANSSON_SONAME)}" echo " iptables: $IPTABLES_PATH" echo " nft: $NFT_PATH" +echo " modprobe: $MODPROBE_PATH" echo echo "Configuration plugins (main.plugins=${config_plugins_default})" diff --git a/meson.build b/meson.build index e6a21af561..45c9645ea7 100644 --- a/meson.build +++ b/meson.build @@ -694,6 +694,7 @@ default_paths = ['/sbin', '/usr/sbin'] progs = [['iptables', default_paths, '/usr/sbin/iptables'], ['nft', default_paths, '/usr/sbin/nft'], ['dnsmasq', default_paths, ''], + ['modprobe', default_paths, '/sbin/modprobe'] ] foreach prog : progs @@ -1071,6 +1072,7 @@ output += '\n' output += ' jansson: ' + jansson_msg + '\n' output += ' iptables: ' + config_h.get('IPTABLES_PATH') + '\n' output += ' nft: ' + config_h.get('NFT_PATH') + '\n' +output += ' modprobe: ' + config_h.get('MODPROBE_PATH') + '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' if enable_modem_manager output += ' mobile-broadband-provider-info-database: ' + mobile_broadband_provider_info_database + '\n' diff --git a/meson_options.txt b/meson_options.txt index 4956afe924..c8827c6abd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,6 +7,7 @@ option('kernel_firmware_dir', type: 'string', value: '/lib/firmware', descriptio option('iptables', type: 'string', value: '', description: 'path to iptables') option('nft', type: 'string', value: '', description: 'path to nft') option('dnsmasq', type: 'string', value: '', description: 'path to dnsmasq') +option('modprobe', type: 'string', value: '', description: 'path to modprobe') # platform option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') diff --git a/src/libnm-platform/nm-platform-utils.c b/src/libnm-platform/nm-platform-utils.c index 2af4a6ab40..08d82fe87a 100644 --- a/src/libnm-platform/nm-platform-utils.c +++ b/src/libnm-platform/nm-platform-utils.c @@ -2180,7 +2180,7 @@ nmp_utils_modprobe(GError **error, gboolean suppress_error_logging, const char * /* construct the argument list */ argv = g_ptr_array_sized_new(4); - g_ptr_array_add(argv, "/sbin/modprobe"); + g_ptr_array_add(argv, MODPROBE_PATH); g_ptr_array_add(argv, "--use-blacklist"); g_ptr_array_add(argv, (char *) arg1); |