mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-18 01:30:42 +02:00
contrib/rpm: split ifup/ifdown compat scripts to new package NetworkManager-initscripts-updown
Previously (on RHEL<=8 and Fedora<=35), NetworkManager package contains the compat scripts nm-ifup/nm-ifdown. If initscripts package (not network-scripts!) is installed, then a RPM trigger links them as alternatives for the ifup/ifdown commands. One problem is that `dnf provides /usr/sbin/ifup` lists the NetworkManager package. Which is technically true, but on RHEL9 where initscripts is not installed by default, `dnf install NetworkManager` does not actually create those scripts. Solve that by moving those scripts to a new subpackage NetworkManager-initscripts-updown. The %post script now always creates the alternatives links, regardless whether initscripts package is installed. Note that on RHEL8, NetworkManager package not only Obsoletes: but also Suggests: the new package. The name "initscripts-updown" is chosen because in the future we might have additonal initscripts/ifcfg related subpackages to contain the ifcfg-rh plugin (NetworkManager-initscripts-ifcfg) or ifcfg-rh migration tools (NetworkManager-initscripts-tools). https://bugzilla.redhat.com/show_bug.cgi?id=2022418 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1061
This commit is contained in:
parent
26c43e4bcc
commit
3f0ec85634
1 changed files with 38 additions and 10 deletions
|
|
@ -19,8 +19,9 @@
|
|||
%global snapshot __SNAPSHOT__
|
||||
%global git_sha __COMMIT__
|
||||
|
||||
%global obsoletes_device_plugins 1:0.9.9.95-1
|
||||
%global obsoletes_ppp_plugin 1:1.5.3
|
||||
%global obsoletes_device_plugins 1:0.9.9.95-1
|
||||
%global obsoletes_ppp_plugin 1:1.5.3
|
||||
%global obsoletes_initscripts_updown 1:1.35.4
|
||||
|
||||
%global systemd_dir %{_prefix}/lib/systemd/system
|
||||
%global sysctl_dir %{_prefix}/lib/sysctl.d
|
||||
|
|
@ -214,6 +215,10 @@ Requires: libndp >= %{libndp_version}
|
|||
Obsoletes: NetworkManager < %{obsoletes_device_plugins}
|
||||
Obsoletes: NetworkManager < %{obsoletes_ppp_plugin}
|
||||
Obsoletes: NetworkManager-wimax < 1.2
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 8
|
||||
Suggests: NetworkManager-initscripts-updown
|
||||
%endif
|
||||
Obsoletes: NetworkManager < %{obsoletes_initscripts_updown}
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 7
|
||||
# Kept for RHEL to ensure that wired 802.1x works out of the box
|
||||
|
|
@ -561,6 +566,20 @@ This tool is still experimental.
|
|||
%endif
|
||||
|
||||
|
||||
%package initscripts-updown
|
||||
Summary: Legacy ifup/ifdown scripts for NetworkManager that replace initscripts (network-scripts)
|
||||
Group: System Environment/Base
|
||||
BuildArch: noarch
|
||||
Requires: NetworkManager
|
||||
Requires: /usr/bin/nmcli
|
||||
Obsoletes: NetworkManager < %{obsoletes_initscripts_updown}
|
||||
|
||||
%description initscripts-updown
|
||||
Installs alternative ifup/ifdown scripts that talk to NetworkManager.
|
||||
This is only for backward compatibility with initscripts (network-scripts).
|
||||
Preferably use nmcli instead.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n NetworkManager-%{real_version}
|
||||
|
||||
|
|
@ -874,7 +893,8 @@ mkdir -p %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version}
|
|||
cp valgrind.suppressions %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version}
|
||||
%endif
|
||||
|
||||
touch %{buildroot}%{_sbindir}/ifup %{buildroot}%{_sbindir}/ifdown
|
||||
touch %{buildroot}%{_sbindir}/ifup
|
||||
touch %{buildroot}%{_sbindir}/ifdown
|
||||
|
||||
|
||||
%check
|
||||
|
|
@ -917,7 +937,8 @@ fi
|
|||
|
||||
%systemd_post %{systemd_units}
|
||||
|
||||
%triggerin -- initscripts
|
||||
|
||||
%post initscripts-updown
|
||||
if [ -f %{_sbindir}/ifup -a ! -L %{_sbindir}/ifup ]; then
|
||||
# initscripts package too old, won't let us set an alternative
|
||||
/usr/sbin/update-alternatives --remove ifup %{_libexecdir}/nm-ifup >/dev/null 2>&1 || :
|
||||
|
|
@ -940,12 +961,16 @@ if [ $1 -eq 0 ]; then
|
|||
|
||||
# Don't kill networking entirely just on package remove
|
||||
#/bin/systemctl stop NetworkManager.service >/dev/null 2>&1 || :
|
||||
|
||||
/usr/sbin/update-alternatives --remove ifup %{_libexecdir}/nm-ifup >/dev/null 2>&1 || :
|
||||
fi
|
||||
%systemd_preun NetworkManager-wait-online.service NetworkManager-dispatcher.service nm-priv-helper.service
|
||||
|
||||
|
||||
%preun initscripts-updown
|
||||
if [ $1 -eq 0 ]; then
|
||||
/usr/sbin/update-alternatives --remove ifup %{_libexecdir}/nm-ifup >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%if %{with nm_cloud_setup}
|
||||
%preun cloud-setup
|
||||
%systemd_preun %{systemd_units_cloud_setup}
|
||||
|
|
@ -994,10 +1019,6 @@ fi
|
|||
%config(noreplace) %{_sysconfdir}/%{name}/NetworkManager.conf
|
||||
%ghost %{_sysconfdir}/%{name}/VPN
|
||||
%{_bindir}/nm-online
|
||||
%{_libexecdir}/nm-ifup
|
||||
%ghost %attr(755, root, root) %{_sbindir}/ifup
|
||||
%{_libexecdir}/nm-ifdown
|
||||
%ghost %attr(755, root, root) %{_sbindir}/ifdown
|
||||
%{_libexecdir}/nm-dhcp-helper
|
||||
%{_libexecdir}/nm-dispatcher
|
||||
%{_libexecdir}/nm-initrd-generator
|
||||
|
|
@ -1163,5 +1184,12 @@ fi
|
|||
%endif
|
||||
|
||||
|
||||
%files initscripts-updown
|
||||
%{_libexecdir}/nm-ifup
|
||||
%ghost %attr(755, root, root) %{_sbindir}/ifup
|
||||
%{_libexecdir}/nm-ifdown
|
||||
%ghost %attr(755, root, root) %{_sbindir}/ifdown
|
||||
|
||||
|
||||
%changelog
|
||||
__CHANGELOG__
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue