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
This commit is contained in:
Jan Vaclav
2023-07-10 11:05:42 +02:00
committed by Fernando Fernandez Mancera
parent 5b8fdd25ab
commit 9a5c7c7228
5 changed files with 21 additions and 1 deletions

View File

@@ -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

View File

@@ -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})"

View File

@@ -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'

View File

@@ -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')

View File

@@ -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);