Accepting request 919783 from home:schubi2
- Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/919783 OBS-URL: https://build.opensuse.org/package/show/security:netfilter/ebtables?expand=0&rev=74
This commit is contained in:
parent
92263e6f79
commit
ef19fac0df
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 20 18:06:09 UTC 2021 - Stefan Schubert <schubi@suse.de>
|
||||
|
||||
- Use libalternatives instead of update-alternatives.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 2 14:23:48 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ebtables
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,6 +16,12 @@
|
||||
#
|
||||
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without libalternatives
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir /var/adm/fillup-templates
|
||||
@ -41,8 +47,12 @@ BuildRequires: xz
|
||||
Requires: netcfg >= 11.6
|
||||
Requires(pre): %fillup_prereq
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if %{with libalternatives}
|
||||
Requires: alts
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
%endif
|
||||
%{?systemd_ordering}
|
||||
|
||||
%description
|
||||
@ -99,20 +109,50 @@ rm -rfv %{buildroot}%{_initrddir}
|
||||
# not used
|
||||
rm -f "%{buildroot}/%{_sysconfdir}/ebtables-config"
|
||||
for i in ebtables ebtables-restore ebtables-save; do
|
||||
ln -fsv "/etc/alternatives/$i" "%{buildroot}/%{_sbindir}/$i"
|
||||
%if ! %{with libalternatives}
|
||||
ln -fsv "/etc/alternatives/$i" "%{buildroot}/%{_sbindir}/$i"
|
||||
%else
|
||||
ln -fsv %{_bindir}/alts "%{buildroot}/%_sbindir/$i"
|
||||
%endif
|
||||
done
|
||||
echo ".so ebtables-legacy.8" >"%buildroot/%_mandir/man8/ebtables.8"
|
||||
# no headers to make use of it
|
||||
rm -f "%buildroot/%_libdir/libebtc.la" "%buildroot/%_libdir/libebtc.so"
|
||||
|
||||
%if %{with libalternatives}
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/ebtables/1.conf <<EOF
|
||||
binary=%{_sbindir}/ebtables-legacy
|
||||
group=ebtables, ebtables-restore, ebtables-save
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-restore
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/ebtables-restore/1.conf <<EOF
|
||||
binary=%{_sbindir}/ebtables-legacy-restore
|
||||
group=ebtables, ebtables-restore, ebtables-save
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-save
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/ebtables-save/1.conf <<EOF
|
||||
binary=%{_sbindir}/ebtables-legacy-save
|
||||
group=ebtables, ebtables-restore, ebtables-save
|
||||
EOF
|
||||
%endif
|
||||
|
||||
%pre
|
||||
%if %{with libalternatives}
|
||||
# removing old update-alternatives entries
|
||||
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then
|
||||
update-alternatives --remove ebtables "%{_sbindir}/ebtables-legacy"
|
||||
fi
|
||||
%endif
|
||||
%service_add_pre %{name}.service
|
||||
|
||||
%post
|
||||
%if ! %{with libalternatives}
|
||||
update-alternatives --force \
|
||||
--install "%{_sbindir}/ebtables" ebtables "%{_sbindir}/ebtables-legacy" 1 \
|
||||
--slave "%{_sbindir}/ebtables-restore" ebtables-restore "%{_sbindir}/ebtables-legacy-restore" \
|
||||
--slave "%{_sbindir}/ebtables-save" ebtables-save "%{_sbindir}/ebtables-legacy-save"
|
||||
%endif
|
||||
%service_add_post %{name}.service
|
||||
%fillup_only
|
||||
|
||||
@ -120,9 +160,11 @@ update-alternatives --force \
|
||||
%service_del_preun %{name}.service
|
||||
|
||||
%postun
|
||||
%if ! %{with libalternatives}
|
||||
if test "$1" = 0; then
|
||||
update-alternatives --remove ebtables "%{_sbindir}/ebtables-legacy"
|
||||
fi
|
||||
%endif
|
||||
%service_del_postun %{name}.service
|
||||
|
||||
%post -n libebtc0 -p /sbin/ldconfig
|
||||
@ -135,9 +177,19 @@ fi
|
||||
%{_mandir}/man8/ebtables*.8*
|
||||
%{_libexecdir}/%{name}-helper
|
||||
%{_unitdir}/%{name}.service
|
||||
%if ! %{with libalternatives}
|
||||
%ghost %{_sysconfdir}/alternatives/ebtables
|
||||
%ghost %{_sysconfdir}/alternatives/ebtables-restore
|
||||
%ghost %{_sysconfdir}/alternatives/ebtables-save
|
||||
%else
|
||||
%dir %{_datadir}/libalternatives
|
||||
%dir %{_datadir}/libalternatives/ebtables
|
||||
%dir %{_datadir}/libalternatives/ebtables-restore
|
||||
%dir %{_datadir}/libalternatives/ebtables-save
|
||||
%{_datadir}/libalternatives/ebtables/1.conf
|
||||
%{_datadir}/libalternatives/ebtables-restore/1.conf
|
||||
%{_datadir}/libalternatives/ebtables-save/1.conf
|
||||
%endif
|
||||
%ghost %{_fillupdir}/sysconfig.%{name}.filter
|
||||
%ghost %{_fillupdir}/sysconfig.%{name}.nat
|
||||
%ghost %{_fillupdir}/sysconfig.%{name}.broute
|
||||
|
Loading…
Reference in New Issue
Block a user