contrib/rpm: merge branch 'th/no-dhclient-default-rh1204226'

https://bugzilla.redhat.com/show_bug.cgi?id=1204226
This commit is contained in:
Thomas Haller 2016-10-27 11:50:52 +02:00
commit 2ce3c42d4f
8 changed files with 67 additions and 11 deletions

View file

@ -808,6 +808,16 @@ else
AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd])
fi
AC_ARG_WITH(config-dhcp-default, AS_HELP_STRING([--with-config-dhcp-default=dhclient|dhcpcd|internal], [Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset]), [config_dhcp_default="$withval"], [config_dhcp_default=""])
if test "$config_dhcp_default" = yes -o "$config_dhcp_default" = no; then
config_dhcp_default=''
fi
test -z "$config_dhcp_default" -a "$with_dhclient" != "no" && config_dhcp_default='dhclient'
test -z "$config_dhcp_default" -a "$with_dhcpcd" != "no" && config_dhcp_default='dhcpcd'
test -z "$config_dhcp_default" && config_dhcp_default='internal'
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting])
AC_SUBST(NM_CONFIG_DEFAULT_DHCP, $config_dhcp_default)
# resolvconf and netconfig support
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support]))
@ -1213,7 +1223,7 @@ echo " netconfig: ${with_netconfig}"
echo " config-dns-rc-manager-default: ${config_dns_rc_manager_default}"
echo
echo "DHCP clients:"
echo "DHCP clients (default $config_dhcp_default):"
echo " dhclient: $with_dhclient"
echo " dhcpcd: $with_dhcpcd"
echo " dhcpcd-supports-ipv6: $with_dhcpcd_supports_ipv6"

View file

@ -0,0 +1,11 @@
# Provided by NetworkManager-config-dhcp-dhclient package
# to enable dhclient dhcp plugin by default.
#
# Do not modify this file, instead
# - uninstall the package NetworkManager-config-dhcp-dhclient
# - shadow the file with /etc/NetworkManager/conf.d/05-dhcp-dhclient.conf
# - overwrite main.dhcp setting in a configuration file in /etc
#
# See man NetworkManager.conf(5)
[main]
dhcp=dhclient

View file

@ -2,18 +2,20 @@
#
# See "man 5 NetworkManager.conf" for details.
#
# The directory /usr/lib/NetworkManager/conf.d/ can contain additional configuration
# snippets installed by packages. These files are read before NetworkManager.conf
# and have thus lowest priority.
# The directories /usr/lib/NetworkManager/conf.d/ and /var/run/NetworkManager/conf.d/
# can contain additional configuration snippets installed by packages. These files are
# read before NetworkManager.conf and have thus lowest priority.
# The directory /etc/NetworkManager/conf.d/ can contain additional configuration
# snippets. Those snippets override the settings from this main file.
# snippets. Those snippets are merged last and overwrite the settings from this main
# file.
#
# The files within one conf.d/ directory are read in asciibetical order.
#
# If /etc/NetworkManager/conf.d/ contains a file with the same name as
# /usr/lib/NetworkManager/conf.d/, the latter file is shadowed and thus ignored.
# Hence, to disable loading a file from /usr/lib/NetworkManager/conf.d/ you can
# put an empty file with the same name.
# put an empty file to etc with the same name. The same applies with respect
# to the directory /var/lib/NetworkManager/conf.d.
#
# If two files define the same key, the one that is read afterwards will overwrite
# the previous one.

View file

@ -25,6 +25,7 @@
%global epoch_version 1
%global obsoletes_device_plugins 1:0.9.9.95-1
%global obsoletes_dhclient 1:1.5.0
%global systemd_dir %{_prefix}/lib/systemd/system
%global nmlibdir %{_prefix}/lib/%{name}
@ -106,6 +107,7 @@ Source: __SOURCE1__
Source1: NetworkManager.conf
Source2: 00-server.conf
Source3: 20-connectivity-fedora.conf
Source4: 05-dhcp-dhclient.conf
#Patch1: 0001-some.patch
@ -116,7 +118,6 @@ Requires(postun): systemd
Requires: dbus >= %{dbus_version}
Requires: glib2 >= %{glib2_version}
Requires: iproute
Requires: dhclient >= 12:4.1.0
Requires: libnl3 >= %{libnl3_version}
Requires: %{name}-libnm%{?_isa} = %{epoch}:%{version}-%{release}
Requires: ppp = %{ppp_version}
@ -333,6 +334,18 @@ ethernet devices with no carrier.
This package is intended to be installed by default for server
deployments.
%package config-dhcp-dhclient
Summary: NetworkManager config file to use dhclient as DHCP plugin
Group: System Environment/Base
BuildArch: noarch
Requires: dhclient >= 12:4.1.0
Provides: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Obsoletes: %{name} < %{obsoletes_dhclient}
%description config-dhcp-dhclient
This adds a NetworkManager configuration file to configure dhclient
as DHCP plugin.
%package dispatcher-routing-rules
Summary: NetworkManager dispatcher file for advanced routing rules
Group: System Environment/Base
@ -426,6 +439,7 @@ intltoolize --automake --copy --force
--with-setting-plugins-default='ifcfg-rh,ibft' \
--with-config-dns-rc-manager-default=symlink \
--with-config-logging-backend-default=journal \
--with-config-dhcp-default=internal \
--enable-json-validation
make %{?_smp_mflags}
@ -446,6 +460,7 @@ mkdir -p %{buildroot}%{nmlibdir}/conf.d
mkdir -p %{buildroot}%{nmlibdir}/VPN
cp %{SOURCE2} %{buildroot}%{nmlibdir}/conf.d/
cp %{SOURCE3} %{buildroot}%{nmlibdir}/conf.d/
cp %{SOURCE4} %{buildroot}%{nmlibdir}/conf.d/
# create a VPN directory
mkdir -p %{buildroot}%{_sysconfdir}/NetworkManager/VPN
@ -662,6 +677,11 @@ fi
%dir %{nmlibdir}/conf.d
%{nmlibdir}/conf.d/00-server.conf
%files config-dhcp-dhclient
%dir %{nmlibdir}
%dir %{nmlibdir}/conf.d
%{nmlibdir}/conf.d/05-dhcp-dhclient.conf
%files dispatcher-routing-rules
%{_sysconfdir}/%{name}/dispatcher.d/10-ifcfg-rh-routes.sh
%{_sysconfdir}/%{name}/dispatcher.d/no-wait.d/10-ifcfg-rh-routes.sh

View file

@ -119,6 +119,7 @@ fi
SOURCE_NETWORKMANAGER_CONF="$(abs_path "$SOURCE_NETWORKMANAGER_CONF" "$SCRIPTDIR/NetworkManager.conf")" || die "invalid \$SOURCE_NETWORKMANAGER_CONF argument"
SOURCE_CONFIG_SERVER="$(abs_path "$SOURCE_CONFIG_SERVER" "$SCRIPTDIR/00-server.conf")" || die "invalid \$SOURCE_CONFIG_SERVER argument"
SOURCE_CONFIG_CONNECTIVITY_FEDORA="$(abs_path "$SOURCE_CONFIG_CONNECTIVITY_FEDORA" "$SCRIPTDIR/20-connectivity-fedora.conf")" || die "invalid \$SOURCE_CONFIG_CONNECTIVITY_FEDORA argument"
SOURCE_CONFIG_DHCP_DHCLIENT="$(abs_path "$SOURCE_CONFIG_DHCP_DHCLIENT" "$SCRIPTDIR/05-dhcp-dhclient.conf")" || die "invalid \$SOURCE_CONFIG_DHCP_DHCLIENT argument"
TEMP="$(mktemp -d "$SCRIPTDIR/NetworkManager.$DATE.XXXXXX")"
TEMPBASE="$(basename "$TEMP")"
@ -156,6 +157,7 @@ cp "$SOURCE" "$TEMP/SOURCES/" || die "Could not copy source $SOURCE to $TEMP/SOU
cp "$SOURCE_NETWORKMANAGER_CONF" "$TEMP/SOURCES/NetworkManager.conf" || die "Could not copy source $SOURCE_NETWORKMANAGER_CONF to $TEMP/SOURCES"
cp "$SOURCE_CONFIG_SERVER" "$TEMP/SOURCES/00-server.conf" || die "Could not copy source $SOURCE_CONFIG_SERVER to $TEMP/SOURCES"
cp "$SOURCE_CONFIG_CONNECTIVITY_FEDORA" "$TEMP/SOURCES/20-connectivity-fedora.conf" || die "Could not copy source $SOURCE_CONFIG_CONNECTIVITY_FEDORA to $TEMP/SOURCES"
cp "$SOURCE_CONFIG_DHCP_DHCLIENT" "$TEMP/SOURCES/05-dhcp-dhclient.conf" || die "Could not copy source $SOURCE_CONFIG_DHCP_DHCLIENT to $TEMP/SOURCES"
write_changelog

View file

@ -189,9 +189,9 @@ plugins-=remove-me
clients to be installed. The <literal>internal</literal>
option uses a built-in DHCP client which is not currently as
featureful as the external clients.</para>
<para>If this key is missing, available DHCP clients are
looked for in this order: <literal>dhclient</literal>,
<literal>dhcpcd</literal>,
<para>If this key is missing, it defaults to <literal>&NM_CONFIG_DEFAULT_DHCP;</literal>.
It the chosen plugin is not available, clients are looked for
in this order: <literal>dhclient</literal>, <literal>dhcpcd</literal>,
<literal>internal</literal>.</para></listitem>
</varlistentry>
<varlistentry>

View file

@ -5,3 +5,4 @@
<!ENTITY NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT "@NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@">
<!ENTITY NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT "@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@">
<!ENTITY NM_CONFIG_DEFAULT_DNS_RC_MANAGER "@NM_CONFIG_DEFAULT_DNS_RC_MANAGER@">
<!ENTITY NM_CONFIG_DEFAULT_DHCP "@NM_CONFIG_DEFAULT_DHCP@">

View file

@ -349,13 +349,23 @@ nm_dhcp_manager_init (NMDhcpManager *self)
if (nm_config_get_configure_and_quit (config)) {
client_factory = &_nm_dhcp_client_factory_internal;
if (client && !nm_streq (client, client_factory->name))
nm_log_warn (LOGD_DHCP, "dhcp-init: Using internal DHCP client since configure-and-quit is set.");
nm_log_info (LOGD_DHCP, "dhcp-init: Using internal DHCP client since configure-and-quit is set.");
} else {
if (client) {
client_factory = _client_factory_available (_client_factory_find_by_name (client));
if (!client_factory)
nm_log_warn (LOGD_DHCP, "dhcp-init: DHCP client '%s' not available", client);
}
if (!client_factory) {
client_factory = _client_factory_find_by_name (""NM_CONFIG_DEFAULT_DHCP);
if (!client_factory)
nm_log_err (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not installed", NM_CONFIG_DEFAULT_DHCP);
else {
client_factory = _client_factory_available (client_factory);
if (!client_factory)
nm_log_info (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not available", NM_CONFIG_DEFAULT_DHCP);
}
}
if (!client_factory) {
for (i = 0; i < G_N_ELEMENTS (_nm_dhcp_manager_factories); i++) {
client_factory = _client_factory_available (_nm_dhcp_manager_factories[i]);