mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-21 12:20:43 +02:00
rpm: install alternative implementations of ifup/ifdown
Unless the initscripts package too old to allow alternatives is present, install nmcli as an alternative implementation of ifup and ifdown. The triggerin scriptlet allow us to do the right thing regardless of which initscripts version is installed or even when it's upgraded. The initscripts patch was included in Fedora 29: https://github.com/fedora-sysv/initscripts/pull/197
This commit is contained in:
parent
d815130468
commit
28d2c07661
1 changed files with 19 additions and 0 deletions
|
|
@ -116,7 +116,9 @@ Source3: 20-connectivity-fedora.conf
|
|||
#Patch1: 0001-some.patch
|
||||
|
||||
Requires(post): systemd
|
||||
Requires(post): /sbin/update-alternatives
|
||||
Requires(preun): systemd
|
||||
Requires(preun): /sbin/update-alternatives
|
||||
Requires(postun): systemd
|
||||
|
||||
Requires: dbus >= %{dbus_version}
|
||||
|
|
@ -565,6 +567,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
|
||||
|
||||
|
||||
%check
|
||||
%if %{with test}
|
||||
|
|
@ -588,6 +592,15 @@ fi
|
|||
|
||||
%systemd_post NetworkManager.service NetworkManager-wait-online.service NetworkManager-dispatcher.service
|
||||
|
||||
%triggerin -- initscripts
|
||||
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 || :
|
||||
else
|
||||
/usr/sbin/update-alternatives --install %{_sbindir}/ifup ifup %{_libexecdir}/nm-ifup 50 \
|
||||
--slave %{_sbindir}/ifdown ifdown %{_libexecdir}/nm-ifdown
|
||||
fi
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
# Package removal, not upgrade
|
||||
|
|
@ -595,6 +608,8 @@ 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
|
||||
|
||||
|
|
@ -628,6 +643,10 @@ fi
|
|||
%dir %{_sysconfdir}/%{name}/dnsmasq-shared.d
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/NetworkManager.conf
|
||||
%{_bindir}/nm-online
|
||||
%{_libexecdir}/nm-ifup
|
||||
%ghost %{_sbindir}/ifup
|
||||
%{_libexecdir}/nm-ifdown
|
||||
%ghost %{_sbindir}/ifdown
|
||||
%{_libexecdir}/nm-dhcp-helper
|
||||
%{_libexecdir}/nm-dispatcher
|
||||
%{_libexecdir}/nm-iface-helper
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue