1
0
forked from jengelh/iptables

compact all the alternative command lines

OBS-URL: https://build.opensuse.org/package/show/security:netfilter/iptables?expand=0&rev=145
This commit is contained in:
Jan Engelhardt 2021-09-16 09:51:41 +00:00 committed by Git OBS Bridge
parent 2dd901f8a9
commit 0685558a3a

View File

@ -26,7 +26,7 @@ Name: iptables
Version: 1.8.7 Version: 1.8.7
Release: 0 Release: 0
Summary: IP packet filter administration utilities Summary: IP packet filter administration utilities
License: GPL-2.0-only AND Artistic-2.0 License: Artistic-2.0 AND GPL-2.0-only
Group: Productivity/Networking/Security Group: Productivity/Networking/Security
URL: https://netfilter.org/projects/iptables/ URL: https://netfilter.org/projects/iptables/
#Git-Clone: git://git.netfilter.org/iptables #Git-Clone: git://git.netfilter.org/iptables
@ -55,7 +55,7 @@ Requires: libalternatives >= 1.2
Requires(pre): update-alternatives Requires(pre): update-alternatives
%else %else
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun): update-alternatives Requires(postun):update-alternatives
%endif %endif
# During the update to iptables 1.8, ip6tables-restore-translate, ip6tables-translate, # During the update to iptables 1.8, ip6tables-restore-translate, ip6tables-translate,
# iptables-restore-translate and iptables-translate were moved from iptables-nft subpackage # iptables-restore-translate and iptables-translate were moved from iptables-nft subpackage
@ -72,9 +72,9 @@ Summary: Metapackage to make nft the default backend for iptables/arptabl
Group: Productivity/Networking/Security Group: Productivity/Networking/Security
Requires: iptables >= 1.8.0 Requires: iptables >= 1.8.0
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun): update-alternatives Requires(postun):update-alternatives
Provides: iptables-nft = %{version}-%{release} Provides: iptables-nft = %version-%release
Obsoletes: iptables-nft < %{version}-%{release} Obsoletes: iptables-nft < %version-%release
%description backend-nft %description backend-nft
Installation of this package adds higher priority alternatives (cf. Installation of this package adds higher priority alternatives (cf.
@ -194,9 +194,9 @@ for i in iptables iptables-restore iptables-save ip6tables ip6tables-restore \
ip6tables-save arptables arptables-restore arptables-save ebtables \ ip6tables-save arptables arptables-restore arptables-save ebtables \
ebtables-restore ebtables-save; do ebtables-restore ebtables-save; do
%if ! %{with libalternatives} %if ! %{with libalternatives}
ln -fsv "/etc/alternatives/$i" "$b/%_sbindir/$i" ln -fsv "%_sysconfdir/alternatives/$i" "$b/%_sbindir/$i"
%else %else
ln -fsv %{_bindir}/alts "$b/%_sbindir/$i" ln -fsv %_bindir/alts "$b/%_sbindir/$i"
%endif %endif
done done
@ -205,52 +205,41 @@ done
%endif %endif
%if %{with libalternatives} %if %{with libalternatives}
mkdir -p %{buildroot}%{_datadir}/libalternatives/iptables mkdir -pv "$b/%_datadir/libalternatives/iptables"
cat > %{buildroot}%{_datadir}/libalternatives/iptables/1.conf <<EOF cat >"$b/%_datadir/libalternatives/iptables/1.conf" <<-EOF
binary=%{_sbindir}/xtables-legacy-multi binary=%_sbindir/xtables-legacy-multi
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
options=KeepArgv0 options=KeepArgv0
EOF EOF
cat > %{buildroot}%{_datadir}/libalternatives/iptables/2.conf <<EOF cat >"$b/%_datadir/libalternatives/iptables/2.conf" <<-EOF
binary=%{_sbindir}/xtables-nft-multi binary=%_sbindir/xtables-nft-multi
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
options=KeepArgv0 options=KeepArgv0
EOF EOF
mkdir -p %{buildroot}%{_datadir}/libalternatives/ip6tables for i in ip6tables ip6tables-restore ip6tables-save iptables-restore iptables-save; do
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/ip6tables/1.conf mkdir -pv "$b/%_datadir/libalternatives/$i"
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/ip6tables/2.conf cp -av "$b/%_datadir/libalternatives/iptables/"*.conf "$b/%_datadir/libalternatives/$i/"
mkdir -p %{buildroot}%{_datadir}/libalternatives/ip6tables-restore done
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/ip6tables-restore/1.conf
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/ip6tables-restore/2.conf
mkdir -p %{buildroot}%{_datadir}/libalternatives/ip6tables-save
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/ip6tables-save/1.conf
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/ip6tables-save/2.conf
mkdir -p %{buildroot}%{_datadir}/libalternatives/iptables-restore
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/iptables-restore/1.conf
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/iptables-restore/2.conf
mkdir -p %{buildroot}%{_datadir}/libalternatives/iptables-save
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/iptables-save/1.conf
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/iptables-save/2.conf
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables mkdir -pv $b/%_datadir/libalternatives/arptables
cat > %{buildroot}%{_datadir}/libalternatives/arptables/2.conf <<EOF cat >"$b/%_datadir/libalternatives/arptables/2.conf" <<-EOF
binary=%{_sbindir}/xtables-nft-multi binary=%_sbindir/xtables-nft-multi
group=arptables, arptables-restore, arptables-save group=arptables, arptables-restore, arptables-save
EOF EOF
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables-restore for i in arptables-restore arptables-save; do
cp %{buildroot}%{_datadir}/libalternatives/arptables/2.conf %{buildroot}%{_datadir}/libalternatives/arptables-restore/2.conf mkdir -pv "$b/%_datadir/libalternatives/$i"
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables-save cp -av "$b/%_datadir/libalternatives/arptables/2.conf" "$b/%_datadir/libalternatives/$i/"
cp %{buildroot}%{_datadir}/libalternatives/arptables/2.conf %{buildroot}%{_datadir}/libalternatives/arptables-save/2.conf done
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables mkdir -p "$b/%_datadir/libalternatives/ebtables"
cat > %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf <<EOF cat >"$b/%_datadir/libalternatives/ebtables/2.conf" <<-EOF
binary=%{_sbindir}/xtables-nft-multi binary=%_sbindir/xtables-nft-multi
group=ebtables, ebtables-restore, ebtables-save group=ebtables, ebtables-restore, ebtables-save
EOF EOF
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-restore for i in ebtables-restore ebtables-save; do
cp %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf %{buildroot}%{_datadir}/libalternatives/ebtables-restore/2.conf mkdir -pv "$b/%_datadir/libalternatives/$i"
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-save cp -av "$b/%_datadir/libalternatives/ebtables/2.conf" "$b/%_datadir/libalternatives/$i/"
cp %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf %{buildroot}%{_datadir}/libalternatives/ebtables-save/2.conf done
%endif %endif
@ -261,6 +250,7 @@ if [ "$1" > 0 ] ; then
update-alternatives --remove iptables "%_sbindir/xtables-legacy-multi" update-alternatives --remove iptables "%_sbindir/xtables-legacy-multi"
fi fi
%else %else
%post %post
update-alternatives \ update-alternatives \
--install "%_sbindir/iptables" iptables "%_sbindir/xtables-legacy-multi" 1 \ --install "%_sbindir/iptables" iptables "%_sbindir/xtables-legacy-multi" 1 \
@ -285,6 +275,7 @@ if test "$1" = 0; then
update-alternatives --remove ebtables "%_sbindir/xtables-nft-multi" update-alternatives --remove ebtables "%_sbindir/xtables-nft-multi"
fi fi
%else %else
%post backend-nft %post backend-nft
update-alternatives \ update-alternatives \
--install "%_sbindir/iptables" iptables "%_sbindir/xtables-nft-multi" 2 \ --install "%_sbindir/iptables" iptables "%_sbindir/xtables-nft-multi" 2 \
@ -342,19 +333,7 @@ fi
%ghost %_sysconfdir/alternatives/ip6tables-restore %ghost %_sysconfdir/alternatives/ip6tables-restore
%ghost %_sysconfdir/alternatives/ip6tables-save %ghost %_sysconfdir/alternatives/ip6tables-save
%else %else
%dir %{_datadir}/libalternatives %_datadir/libalternatives/
%dir %{_datadir}/libalternatives/iptables
%dir %{_datadir}/libalternatives/iptables-restore
%dir %{_datadir}/libalternatives/iptables-save
%dir %{_datadir}/libalternatives/ip6tables
%dir %{_datadir}/libalternatives/ip6tables-restore
%dir %{_datadir}/libalternatives/ip6tables-save
%{_datadir}/libalternatives/iptables/1.conf
%{_datadir}/libalternatives/iptables-restore/1.conf
%{_datadir}/libalternatives/iptables-save/1.conf
%{_datadir}/libalternatives/ip6tables/1.conf
%{_datadir}/libalternatives/ip6tables-restore/1.conf
%{_datadir}/libalternatives/ip6tables-save/1.conf
%endif %endif
%_sbindir/iptables %_sbindir/iptables
%_sbindir/iptables-restore %_sbindir/iptables-restore
@ -378,31 +357,7 @@ fi
%ghost %_sysconfdir/alternatives/ebtables-restore %ghost %_sysconfdir/alternatives/ebtables-restore
%ghost %_sysconfdir/alternatives/ebtables-save %ghost %_sysconfdir/alternatives/ebtables-save
%else %else
%dir %{_datadir}/libalternatives %_datadir/libalternatives/
%dir %{_datadir}/libalternatives/iptables
%dir %{_datadir}/libalternatives/iptables-restore
%dir %{_datadir}/libalternatives/iptables-save
%dir %{_datadir}/libalternatives/ip6tables
%dir %{_datadir}/libalternatives/ip6tables-restore
%dir %{_datadir}/libalternatives/ip6tables-save
%dir %{_datadir}/libalternatives/arptables
%dir %{_datadir}/libalternatives/arptables-restore
%dir %{_datadir}/libalternatives/arptables-save
%dir %{_datadir}/libalternatives/ebtables
%dir %{_datadir}/libalternatives/ebtables-restore
%dir %{_datadir}/libalternatives/ebtables-save
%{_datadir}/libalternatives/iptables/2.conf
%{_datadir}/libalternatives/iptables-restore/2.conf
%{_datadir}/libalternatives/iptables-save/2.conf
%{_datadir}/libalternatives/ip6tables/2.conf
%{_datadir}/libalternatives/ip6tables-restore/2.conf
%{_datadir}/libalternatives/ip6tables-save/2.conf
%{_datadir}/libalternatives/arptables/2.conf
%{_datadir}/libalternatives/arptables-restore/2.conf
%{_datadir}/libalternatives/arptables-save/2.conf
%{_datadir}/libalternatives/ebtables/2.conf
%{_datadir}/libalternatives/ebtables-restore/2.conf
%{_datadir}/libalternatives/ebtables-save/2.conf
%endif %endif
%_sbindir/iptables %_sbindir/iptables
%_sbindir/iptables-restore %_sbindir/iptables-restore