From e4660336e7d1e6748692d24fc42520df1838efc1 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:07:33 +0200 Subject: [PATCH 1/6] contrib/rpm: turn %config_plugins_default_ifcfg_rh into a bcond --- contrib/fedora/rpm/NetworkManager.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index ee67a05d3e..9f5f21171d 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -160,9 +160,9 @@ %endif %if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 -%global config_plugins_default_ifcfg_rh 0 +%bcond_with default_ifcfg_rh %else -%global config_plugins_default_ifcfg_rh 1 +%bcond_without default_ifcfg_rh %endif %if 0%{?rhel} >= 10 @@ -772,7 +772,7 @@ Preferably use nmcli instead. -Dfirewalld_zone=false \ %endif -Ddist_version=%{version}-%{release} \ -%if %{?config_plugins_default_ifcfg_rh} +%if %{with default_ifcfg_rh} -Dconfig_plugins_default=ifcfg-rh \ %endif %if %{?ifcfg_migrate} @@ -924,7 +924,7 @@ autoreconf --install --force --enable-firewalld-zone=no \ %endif --with-dist-version=%{version}-%{release} \ -%if %{?config_plugins_default_ifcfg_rh} +%if %{with default_ifcfg_rh} --with-config-plugins-default=ifcfg-rh \ %endif %if %{?ifcfg_migrate} From 2066e1743eadfa18aaa5c5921f195a0077a7b9de Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:09:00 +0200 Subject: [PATCH 2/6] contrib/rpm: turn %with_ifcfg_rh into a bcond --- contrib/fedora/rpm/NetworkManager.spec | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 9f5f21171d..8aa07b1ff2 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -166,13 +166,13 @@ %endif %if 0%{?rhel} >= 10 -%global with_ifcfg_rh 0 +%bcond_with ifcfg_rh %global split_ifcfg_rh 0 %elif 0%{?fedora} >= 36 -%global with_ifcfg_rh 1 +%bcond_without ifcfg_rh %global split_ifcfg_rh 1 %else -%global with_ifcfg_rh 1 +%bcond_without ifcfg_rh %global split_ifcfg_rh 0 %endif @@ -567,7 +567,7 @@ This package is intended to be installed by default for server deployments. -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %package dispatcher-routing-rules Summary: NetworkManager dispatcher file for advanced routing rules Group: System Environment/Base @@ -626,7 +626,7 @@ like Aliyun, Azure, EC2, GCP are supported. %endif -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %package initscripts-updown Summary: Legacy ifup/ifdown scripts for NetworkManager that replace initscripts (network-scripts) Group: System Environment/Base @@ -753,7 +753,7 @@ Preferably use nmcli instead. -Ddbus_conf_dir=%{dbus_sys_dir} \ -Dtests=yes \ -Dvalgrind=no \ -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} -Difcfg_rh=true \ %else -Difcfg_rh=false \ @@ -905,7 +905,7 @@ autoreconf --install --force --enable-more-warnings=yes \ %endif --with-valgrind=no \ -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} --enable-ifcfg-rh=yes \ %else --enable-ifcfg-rh=no \ @@ -972,7 +972,7 @@ cp %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts cp %{SOURCE9} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt %endif -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} cp examples/dispatcher/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/ ln -s ../no-wait.d/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/pre-up.d/ ln -s ../10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/no-wait.d/ @@ -992,7 +992,7 @@ mkdir -p %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version} cp valgrind.suppressions %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version} %endif -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} touch %{buildroot}%{_sbindir}/ifup touch %{buildroot}%{_sbindir}/ifdown %endif @@ -1038,7 +1038,7 @@ fi %systemd_post %{systemd_units} -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %post initscripts-updown if [ -f %{_sbindir}/ifup -a ! -L %{_sbindir}/ifup ]; then # initscripts package too old, won't let us set an alternative @@ -1067,7 +1067,7 @@ fi %systemd_preun NetworkManager-wait-online.service NetworkManager-dispatcher.service nm-priv-helper.service -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %preun initscripts-updown if [ $1 -eq 0 ]; then /usr/sbin/update-alternatives --remove ifup %{_libexecdir}/nm-ifup >/dev/null 2>&1 || : @@ -1107,7 +1107,7 @@ fi %{dbus_sys_dir}/org.freedesktop.NetworkManager.conf %{dbus_sys_dir}/nm-dispatcher.conf %{dbus_sys_dir}/nm-priv-helper.conf -%if %{?with_ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 +%if %{with ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 %{dbus_sys_dir}/nm-ifcfg-rh.conf %endif %{_sbindir}/%{name} @@ -1135,7 +1135,7 @@ fi %{_libexecdir}/nm-priv-helper %dir %{_libdir}/%{name} %dir %{nmplugindir} -%if %{?with_ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 +%if %{with ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 %{nmplugindir}/libnm-settings-plugin-ifcfg-rh.so %endif %if %{with nmtui} @@ -1157,7 +1157,7 @@ fi %{_mandir}/man8/NetworkManager-dispatcher.8* %{_mandir}/man8/NetworkManager-wait-online.service.8* %dir %{_localstatedir}/lib/NetworkManager -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %dir %{_sysconfdir}/sysconfig/network-scripts %endif %{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service @@ -1274,7 +1274,7 @@ fi %{nmlibdir}/conf.d/00-server.conf -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %files dispatcher-routing-rules %{nmlibdir}/dispatcher.d/10-ifcfg-rh-routes.sh %{nmlibdir}/dispatcher.d/no-wait.d/10-ifcfg-rh-routes.sh @@ -1310,7 +1310,7 @@ fi %endif -%if %{?with_ifcfg_rh} +%if %{with ifcfg_rh} %files initscripts-updown %{_libexecdir}/nm-ifup %ghost %attr(755, root, root) %{_sbindir}/ifup From cfc6cd7a7461f10b2470f6c88fd00fc40aad50af Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:10:38 +0200 Subject: [PATCH 3/6] contrib/rpm: turn %split_ifcfg_rh into a bcond --- contrib/fedora/rpm/NetworkManager.spec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 8aa07b1ff2..56e892450c 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -167,13 +167,13 @@ %if 0%{?rhel} >= 10 %bcond_with ifcfg_rh -%global split_ifcfg_rh 0 +%bcond_with split_ifcfg_rh %elif 0%{?fedora} >= 36 %bcond_without ifcfg_rh -%global split_ifcfg_rh 1 +%bcond_without split_ifcfg_rh %else %bcond_without ifcfg_rh -%global split_ifcfg_rh 0 +%bcond_with split_ifcfg_rh %endif %if (0%{?fedora} >= 36 && 0%{?fedora} < 39) || 0%{?rhel} == 9 @@ -250,7 +250,7 @@ Obsoletes: NetworkManager-wimax < 1:1.2 Suggests: NetworkManager-initscripts-updown %endif Obsoletes: NetworkManager < %{obsoletes_initscripts_updown} -%if 0%{?split_ifcfg_rh} +%if %{with split_ifcfg_rh} Obsoletes: NetworkManager < %{obsoletes_ifcfg_rh} %endif @@ -571,7 +571,7 @@ deployments. %package dispatcher-routing-rules Summary: NetworkManager dispatcher file for advanced routing rules Group: System Environment/Base -%if 0%{?split_ifcfg_rh} +%if %{with split_ifcfg_rh} Requires: %{name}-initscripts-ifcfg-rh %endif BuildArch: noarch @@ -599,7 +599,7 @@ by nm-connection-editor and nm-applet in a non-graphical environment. %endif -%if 0%{?split_ifcfg_rh} +%if %{with split_ifcfg_rh} %package initscripts-ifcfg-rh Summary: NetworkManager plugin for reading and writing connections in ifcfg-rh format Group: System Environment/Base @@ -1107,7 +1107,7 @@ fi %{dbus_sys_dir}/org.freedesktop.NetworkManager.conf %{dbus_sys_dir}/nm-dispatcher.conf %{dbus_sys_dir}/nm-priv-helper.conf -%if %{with ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 +%if %{with ifcfg_rh} && %{without split_ifcfg_rh} %{dbus_sys_dir}/nm-ifcfg-rh.conf %endif %{_sbindir}/%{name} @@ -1135,7 +1135,7 @@ fi %{_libexecdir}/nm-priv-helper %dir %{_libdir}/%{name} %dir %{nmplugindir} -%if %{with ifcfg_rh} && 0%{?split_ifcfg_rh} == 0 +%if %{with ifcfg_rh} && %{without split_ifcfg_rh} %{nmplugindir}/libnm-settings-plugin-ifcfg-rh.so %endif %if %{with nmtui} @@ -1291,7 +1291,7 @@ fi %endif -%if 0%{?split_ifcfg_rh} +%if %{with split_ifcfg_rh} %files initscripts-ifcfg-rh %{nmplugindir}/libnm-settings-plugin-ifcfg-rh.so %{dbus_sys_dir}/nm-ifcfg-rh.conf From 151decd333c2a3925d0c57bd28892d5991ea01fc Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:11:19 +0200 Subject: [PATCH 4/6] contrib/rpm: turn %ifcfg_warning into a bcond --- contrib/fedora/rpm/NetworkManager.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 56e892450c..3f3f02646e 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -177,9 +177,9 @@ %endif %if (0%{?fedora} >= 36 && 0%{?fedora} < 39) || 0%{?rhel} == 9 -%global ifcfg_warning 1 +%bcond_without ifcfg_warning %else -%global ifcfg_warning 0 +%bcond_with ifcfg_warning %endif %if 0%{?fedora} >= 39 @@ -965,7 +965,7 @@ cp %{SOURCE7} %{buildroot}%{_sysctldir} cp %{SOURCE6} %{buildroot}%{nmlibdir}/conf.d/ %endif -%if 0%{?ifcfg_warning} +%if %{with ifcfg_warning} cp %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts %endif %if 0%{?ifcfg_migrate} @@ -1174,7 +1174,7 @@ fi %{_unitdir}/nm-priv-helper.service %dir %{_datadir}/doc/NetworkManager/examples %{_datadir}/doc/NetworkManager/examples/server.conf -%if 0%{?ifcfg_warning} || 0%{?ifcfg_migrate} +%if %{with ifcfg_warning} || 0%{?ifcfg_migrate} %{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt %endif %doc NEWS AUTHORS README.md CONTRIBUTING.md From 3d0ddfd6be56b1652d79b276aeadd9295cc84dd3 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:12:25 +0200 Subject: [PATCH 5/6] contrib/rpm: turn %ifcfg_migrate into a bcond --- contrib/fedora/rpm/NetworkManager.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 3f3f02646e..2b3803b924 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -183,9 +183,9 @@ %endif %if 0%{?fedora} >= 39 -%global ifcfg_migrate 1 +%bcond_without ifcfg_migrate %else -%global ifcfg_migrate 0 +%bcond_with ifcfg_migrate %endif %if 0%{?fedora} @@ -775,7 +775,7 @@ Preferably use nmcli instead. %if %{with default_ifcfg_rh} -Dconfig_plugins_default=ifcfg-rh \ %endif -%if %{?ifcfg_migrate} +%if %{with ifcfg_migrate} -Dconfig_migrate_ifcfg_rh_default=true \ %endif -Dresolvconf=no \ @@ -927,7 +927,7 @@ autoreconf --install --force %if %{with default_ifcfg_rh} --with-config-plugins-default=ifcfg-rh \ %endif -%if %{?ifcfg_migrate} +%if %{with ifcfg_migrate} --with-config-migrate-ifcfg-rh-default=yes \ %endif --with-resolvconf=no \ @@ -968,7 +968,7 @@ cp %{SOURCE6} %{buildroot}%{nmlibdir}/conf.d/ %if %{with ifcfg_warning} cp %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts %endif -%if 0%{?ifcfg_migrate} +%if %{with ifcfg_migrate} cp %{SOURCE9} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt %endif @@ -1174,7 +1174,7 @@ fi %{_unitdir}/nm-priv-helper.service %dir %{_datadir}/doc/NetworkManager/examples %{_datadir}/doc/NetworkManager/examples/server.conf -%if %{with ifcfg_warning} || 0%{?ifcfg_migrate} +%if %{with ifcfg_warning} || %{with ifcfg_migrate} %{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt %endif %doc NEWS AUTHORS README.md CONTRIBUTING.md From 51a43fb301808154bd78f2fa7ae451029d99a113 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 29 May 2024 15:24:13 +0200 Subject: [PATCH 6/6] contrib/rpm: pull in formatting fixes from Fedora --- contrib/fedora/rpm/NetworkManager.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 2b3803b924..8b5e97aa12 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -641,6 +641,7 @@ This is only for backward compatibility with initscripts (network-scripts). Preferably use nmcli instead. %endif + %prep %autosetup -p1 -n NetworkManager-%{real_version} @@ -908,7 +909,7 @@ autoreconf --install --force %if %{with ifcfg_rh} --enable-ifcfg-rh=yes \ %else - --enable-ifcfg-rh=no \ + --enable-ifcfg-rh=no \ %endif --enable-ifupdown=no \ %if %{with ppp} @@ -997,6 +998,7 @@ touch %{buildroot}%{_sbindir}/ifup touch %{buildroot}%{_sbindir}/ifdown %endif + %check %if %{with meson} %if %{with test} @@ -1281,6 +1283,7 @@ fi %{nmlibdir}/dispatcher.d/pre-up.d/10-ifcfg-rh-routes.sh %endif + %if %{with nmtui} %files tui %{_bindir}/nmtui