build: make path to polkit-agent-helper-1 binary configurable
Add new configure option to set the path to "polkit-agent-helper-1". The path cannot be obtained from pkg-config and `pkg-config --variable=prefix polkit-agent-1` is not good enough. On Fedora, the path is "/usr/lib/polkit-1/polkit-agent-helper-1". On Debian Buster, the path is "/usr/lib/policykit-1/polkit-agent-helper-1" On Debian Sid, the path is "/usr/libexec/polkit-agent-helper-1" (but currently it is also symlinked from "/usr/lib/policykit-1/polkit-agent-helper-1".
This commit is contained in:
1
NEWS
1
NEWS
@@ -28,6 +28,7 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
||||
* initrd: support new ip method "link6" for IPv6 link-local only.
|
||||
* ci: use ci-templates for containers on gitlab-ci.
|
||||
* ci: test build against Alpine Linux on gitlab-ci.
|
||||
* build: new configure option to set path to "polkit-agent-helper-1".
|
||||
* Many bugfixes and improvements.
|
||||
|
||||
=============================================
|
||||
|
@@ -501,7 +501,7 @@ begin_authentication(AuthRequest *request)
|
||||
{
|
||||
int fd_flags;
|
||||
const char *helper_argv[] = {
|
||||
POLKIT_PACKAGE_PREFIX "/lib/polkit-1/polkit-agent-helper-1",
|
||||
POLKIT_AGENT_HELPER_1_PATH,
|
||||
request->username,
|
||||
NULL,
|
||||
};
|
||||
|
@@ -109,6 +109,9 @@
|
||||
/* Define to the full name and version of this package. */
|
||||
#mesondefine PACKAGE_STRING
|
||||
|
||||
/* path to polkit-agent-helper-1 binary */
|
||||
#mesondefine POLKIT_AGENT_HELPER_1_PATH
|
||||
|
||||
/* Path to resolvconf */
|
||||
#mesondefine RESOLVCONF_PATH
|
||||
|
||||
@@ -218,9 +221,6 @@
|
||||
/* Define if you have oFono support (experimental) */
|
||||
#mesondefine WITH_OFONO
|
||||
|
||||
/* Define the polkit agent package prefix */
|
||||
#mesondefine POLKIT_PACKAGE_PREFIX
|
||||
|
||||
/* Define if you have PPP support */
|
||||
#mesondefine WITH_PPP
|
||||
|
||||
|
28
configure.ac
28
configure.ac
@@ -642,16 +642,25 @@ fi
|
||||
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "$enable_polkit", [The default value of the auth-polkit configuration option])
|
||||
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT, "$enable_polkit")
|
||||
|
||||
PKG_CHECK_MODULES(POLKIT, [polkit-agent-1 >= 0.97], [have_pk_agent=yes],[have_pk_agent=no])
|
||||
if test x"$have_pk_agent" = x"no"; then
|
||||
POLKIT_PACKAGE_PREFIX="/usr"
|
||||
else
|
||||
POLKIT_PACKAGE_PREFIX=`$PKG_CONFIG --variable=prefix polkit-agent-1`
|
||||
AC_ARG_WITH([polkit-agent-helper-1-path],
|
||||
AS_HELP_STRING([--with-polkit-agent-helper-1-path=PATH],
|
||||
[Path name to the polkit-agent-helper-1 binary from polkit]),
|
||||
POLKIT_AGENT_HELPER_1_PATH="$withval",
|
||||
POLKIT_AGENT_HELPER_1_PATH="")
|
||||
if test -z "$POLKIT_AGENT_HELPER_1_PATH" ; then
|
||||
for p in /usr/libexec/polkit-agent-helper-1 \
|
||||
/usr/lib/polkit-1/polkit-agent-helper-1 \
|
||||
/usr/lib/policykit-1/polkit-agent-helper-1 ; do
|
||||
if test -f "$p" ; then
|
||||
POLKIT_AGENT_HELPER_1_PATH="$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([POLKIT_PACKAGE_PREFIX],
|
||||
["$POLKIT_PACKAGE_PREFIX"],
|
||||
[polkit-agent package prefix])
|
||||
|
||||
test -z "$POLKIT_AGENT_HELPER_1_PATH" && POLKIT_AGENT_HELPER_1_PATH=/usr/lib/polkit-1/polkit-agent-helper-1
|
||||
AC_DEFINE_UNQUOTED([POLKIT_AGENT_HELPER_1_PATH],
|
||||
["$POLKIT_AGENT_HELPER_1_PATH"],
|
||||
[path to polkit-agent-helper-1 binary])
|
||||
|
||||
AC_ARG_ENABLE(modify-system, AS_HELP_STRING([--enable-modify-system], [Allow users to modify system connections]))
|
||||
if test "${enable_modify_system}" = "yes"; then
|
||||
@@ -1332,6 +1341,7 @@ if test "${enable_modify_system}" = "yes"; then
|
||||
else
|
||||
echo " policykit: main.auth-polkit=${enable_polkit} (restrictive modify.system)"
|
||||
fi
|
||||
echo " polkit-agent-helper-1: $POLKIT_AGENT_HELPER_1_PATH"
|
||||
echo " selinux: $have_selinux"
|
||||
echo " systemd-journald: $have_systemd_journal (default: logging.backend=${nm_config_logging_backend_default})"
|
||||
echo " hostname persist: ${hostname_persist}"
|
||||
|
17
meson.build
17
meson.build
@@ -514,12 +514,18 @@ config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT', config_auth_polkit_def
|
||||
|
||||
enable_modify_system = get_option('modify_system')
|
||||
|
||||
polkit_agent_dep = dependency('polkit-agent-1', version: '>= 0.97', required : false)
|
||||
if polkit_agent_dep.found()
|
||||
config_h.set_quoted('POLKIT_PACKAGE_PREFIX', polkit_agent_dep.get_pkgconfig_variable('prefix'))
|
||||
else
|
||||
config_h.set_quoted('POLKIT_PACKAGE_PREFIX', '/usr')
|
||||
polkit_agent_helper_1_path = get_option('polkit_agent_helper_1_path')
|
||||
foreach p : [ '/usr/libexec/polkit-agent-helper-1',
|
||||
'/usr/lib/polkit-1/polkit-agent-helper-1',
|
||||
'/usr/lib/policykit-1/polkit-agent-helper-1' ]
|
||||
if polkit_agent_helper_1_path == '' and run_command('test', '-f', p).returncode() == 0
|
||||
polkit_agent_helper_1_path = p
|
||||
endif
|
||||
endforeach
|
||||
if polkit_agent_helper_1_path == ''
|
||||
polkit_agent_helper_1_path = '/usr/lib/polkit-1/polkit-agent-helper-1'
|
||||
endif
|
||||
config_h.set_quoted('POLKIT_AGENT_HELPER_1_PATH', polkit_agent_helper_1_path)
|
||||
|
||||
|
||||
crypto = get_option('crypto')
|
||||
@@ -1016,6 +1022,7 @@ if enable_polkit
|
||||
output += ' modify.system)'
|
||||
endif
|
||||
output += '\n'
|
||||
output += ' polkit-agent-helper-1: ' + polkit_agent_helper_1_path + '\n'
|
||||
output += ' selinux: ' + enable_selinux.to_string() + '\n'
|
||||
output += ' systemd-journald: ' + enable_systemd_journal.to_string() + ' (default: logging.backend=' + config_logging_backend_default + ')\n'
|
||||
output += ' hostname persist: ' + hostname_persist + '\n'
|
||||
|
@@ -16,7 +16,7 @@ option('suspend_resume', type: 'combo', choices: ['upower', 'systemd', 'elogind'
|
||||
option('polkit', type: 'boolean', value: true, description: 'User auth-polkit configuration option.')
|
||||
option('config_auth_polkit_default', type: 'combo', choices: ['default', 'true', 'false', 'root-only'], value: 'default', description: 'Default value for configuration main.auth-polkit.')
|
||||
option('modify_system', type: 'boolean', value: false, description: 'Allow users to modify system connections')
|
||||
option('polkit_agent', type: 'boolean', value: false, description: 'enable polkit agent for clients')
|
||||
option('polkit_agent_helper_1_path', type: 'string', value: '', description: 'Path name to the polkit-agent-helper-1 binary from polkit')
|
||||
option('selinux', type: 'boolean', value: true, description: 'Build with SELinux')
|
||||
option('systemd_journal', type: 'boolean', value: true, description: 'Use systemd journal for logging')
|
||||
option('config_logging_backend_default', type: 'combo', choices: ['default', 'syslog', 'journal'], value: 'default', description: 'Default value for logging.backend')
|
||||
|
Reference in New Issue
Block a user