diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-05-21 17:40:41 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-11 15:09:42 +0200 |
commit | 60451a02c23bedd5b4beceb2f68eda5d4a30c8b9 (patch) | |
tree | 8ddb7a1396b992e3af431f2f1f20b61ab1502d90 /contrib | |
parent | 0137721d9a92e9e9fe151eb250af679be912e31f (diff) |
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
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/fedora/rpm/NetworkManager.spec | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index c6f265c21..7289bc4fc 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -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 |