contrib/rpm: turn %with_ifcfg_rh into a bcond

This commit is contained in:
Lubomir Rintel
2024-05-29 15:09:00 +02:00
parent e4660336e7
commit 2066e1743e

View File

@@ -166,13 +166,13 @@
%endif %endif
%if 0%{?rhel} >= 10 %if 0%{?rhel} >= 10
%global with_ifcfg_rh 0 %bcond_with ifcfg_rh
%global split_ifcfg_rh 0 %global split_ifcfg_rh 0
%elif 0%{?fedora} >= 36 %elif 0%{?fedora} >= 36
%global with_ifcfg_rh 1 %bcond_without ifcfg_rh
%global split_ifcfg_rh 1 %global split_ifcfg_rh 1
%else %else
%global with_ifcfg_rh 1 %bcond_without ifcfg_rh
%global split_ifcfg_rh 0 %global split_ifcfg_rh 0
%endif %endif
@@ -567,7 +567,7 @@ This package is intended to be installed by default for server
deployments. deployments.
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%package dispatcher-routing-rules %package dispatcher-routing-rules
Summary: NetworkManager dispatcher file for advanced routing rules Summary: NetworkManager dispatcher file for advanced routing rules
Group: System Environment/Base Group: System Environment/Base
@@ -626,7 +626,7 @@ like Aliyun, Azure, EC2, GCP are supported.
%endif %endif
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%package initscripts-updown %package initscripts-updown
Summary: Legacy ifup/ifdown scripts for NetworkManager that replace initscripts (network-scripts) Summary: Legacy ifup/ifdown scripts for NetworkManager that replace initscripts (network-scripts)
Group: System Environment/Base Group: System Environment/Base
@@ -753,7 +753,7 @@ Preferably use nmcli instead.
-Ddbus_conf_dir=%{dbus_sys_dir} \ -Ddbus_conf_dir=%{dbus_sys_dir} \
-Dtests=yes \ -Dtests=yes \
-Dvalgrind=no \ -Dvalgrind=no \
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
-Difcfg_rh=true \ -Difcfg_rh=true \
%else %else
-Difcfg_rh=false \ -Difcfg_rh=false \
@@ -905,7 +905,7 @@ autoreconf --install --force
--enable-more-warnings=yes \ --enable-more-warnings=yes \
%endif %endif
--with-valgrind=no \ --with-valgrind=no \
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
--enable-ifcfg-rh=yes \ --enable-ifcfg-rh=yes \
%else %else
--enable-ifcfg-rh=no \ --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 cp %{SOURCE9} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt
%endif %endif
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
cp examples/dispatcher/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/ 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 ../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/ 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} cp valgrind.suppressions %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version}
%endif %endif
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
touch %{buildroot}%{_sbindir}/ifup touch %{buildroot}%{_sbindir}/ifup
touch %{buildroot}%{_sbindir}/ifdown touch %{buildroot}%{_sbindir}/ifdown
%endif %endif
@@ -1038,7 +1038,7 @@ fi
%systemd_post %{systemd_units} %systemd_post %{systemd_units}
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%post initscripts-updown %post initscripts-updown
if [ -f %{_sbindir}/ifup -a ! -L %{_sbindir}/ifup ]; then if [ -f %{_sbindir}/ifup -a ! -L %{_sbindir}/ifup ]; then
# initscripts package too old, won't let us set an alternative # 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 %systemd_preun NetworkManager-wait-online.service NetworkManager-dispatcher.service nm-priv-helper.service
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%preun initscripts-updown %preun initscripts-updown
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
/usr/sbin/update-alternatives --remove ifup %{_libexecdir}/nm-ifup >/dev/null 2>&1 || : /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}/org.freedesktop.NetworkManager.conf
%{dbus_sys_dir}/nm-dispatcher.conf %{dbus_sys_dir}/nm-dispatcher.conf
%{dbus_sys_dir}/nm-priv-helper.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 %{dbus_sys_dir}/nm-ifcfg-rh.conf
%endif %endif
%{_sbindir}/%{name} %{_sbindir}/%{name}
@@ -1135,7 +1135,7 @@ fi
%{_libexecdir}/nm-priv-helper %{_libexecdir}/nm-priv-helper
%dir %{_libdir}/%{name} %dir %{_libdir}/%{name}
%dir %{nmplugindir} %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 %{nmplugindir}/libnm-settings-plugin-ifcfg-rh.so
%endif %endif
%if %{with nmtui} %if %{with nmtui}
@@ -1157,7 +1157,7 @@ fi
%{_mandir}/man8/NetworkManager-dispatcher.8* %{_mandir}/man8/NetworkManager-dispatcher.8*
%{_mandir}/man8/NetworkManager-wait-online.service.8* %{_mandir}/man8/NetworkManager-wait-online.service.8*
%dir %{_localstatedir}/lib/NetworkManager %dir %{_localstatedir}/lib/NetworkManager
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%dir %{_sysconfdir}/sysconfig/network-scripts %dir %{_sysconfdir}/sysconfig/network-scripts
%endif %endif
%{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service %{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service
@@ -1274,7 +1274,7 @@ fi
%{nmlibdir}/conf.d/00-server.conf %{nmlibdir}/conf.d/00-server.conf
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%files dispatcher-routing-rules %files dispatcher-routing-rules
%{nmlibdir}/dispatcher.d/10-ifcfg-rh-routes.sh %{nmlibdir}/dispatcher.d/10-ifcfg-rh-routes.sh
%{nmlibdir}/dispatcher.d/no-wait.d/10-ifcfg-rh-routes.sh %{nmlibdir}/dispatcher.d/no-wait.d/10-ifcfg-rh-routes.sh
@@ -1310,7 +1310,7 @@ fi
%endif %endif
%if %{?with_ifcfg_rh} %if %{with ifcfg_rh}
%files initscripts-updown %files initscripts-updown
%{_libexecdir}/nm-ifup %{_libexecdir}/nm-ifup
%ghost %attr(755, root, root) %{_sbindir}/ifup %ghost %attr(755, root, root) %{_sbindir}/ifup