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:
parent
2dd901f8a9
commit
0685558a3a
125
iptables.spec
125
iptables.spec
@ -26,7 +26,7 @@ Name: iptables
|
||||
Version: 1.8.7
|
||||
Release: 0
|
||||
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
|
||||
URL: https://netfilter.org/projects/iptables/
|
||||
#Git-Clone: git://git.netfilter.org/iptables
|
||||
@ -55,7 +55,7 @@ Requires: libalternatives >= 1.2
|
||||
Requires(pre): update-alternatives
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
%endif
|
||||
# During the update to iptables 1.8, ip6tables-restore-translate, ip6tables-translate,
|
||||
# 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
|
||||
Requires: iptables >= 1.8.0
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
Provides: iptables-nft = %{version}-%{release}
|
||||
Obsoletes: iptables-nft < %{version}-%{release}
|
||||
Requires(postun):update-alternatives
|
||||
Provides: iptables-nft = %version-%release
|
||||
Obsoletes: iptables-nft < %version-%release
|
||||
|
||||
%description backend-nft
|
||||
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 \
|
||||
ebtables-restore ebtables-save; do
|
||||
%if ! %{with libalternatives}
|
||||
ln -fsv "/etc/alternatives/$i" "$b/%_sbindir/$i"
|
||||
ln -fsv "%_sysconfdir/alternatives/$i" "$b/%_sbindir/$i"
|
||||
%else
|
||||
ln -fsv %{_bindir}/alts "$b/%_sbindir/$i"
|
||||
ln -fsv %_bindir/alts "$b/%_sbindir/$i"
|
||||
%endif
|
||||
done
|
||||
|
||||
@ -205,52 +205,41 @@ done
|
||||
%endif
|
||||
|
||||
%if %{with libalternatives}
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/iptables
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/iptables/1.conf <<EOF
|
||||
binary=%{_sbindir}/xtables-legacy-multi
|
||||
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
|
||||
options=KeepArgv0
|
||||
mkdir -pv "$b/%_datadir/libalternatives/iptables"
|
||||
cat >"$b/%_datadir/libalternatives/iptables/1.conf" <<-EOF
|
||||
binary=%_sbindir/xtables-legacy-multi
|
||||
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
|
||||
options=KeepArgv0
|
||||
EOF
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/iptables/2.conf <<EOF
|
||||
binary=%{_sbindir}/xtables-nft-multi
|
||||
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
|
||||
options=KeepArgv0
|
||||
cat >"$b/%_datadir/libalternatives/iptables/2.conf" <<-EOF
|
||||
binary=%_sbindir/xtables-nft-multi
|
||||
group=iptables, ip6tables, ip6tables-restore, ip6tables-save, iptables-restore, iptables-save
|
||||
options=KeepArgv0
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ip6tables
|
||||
cp %{buildroot}%{_datadir}/libalternatives/iptables/1.conf %{buildroot}%{_datadir}/libalternatives/ip6tables/1.conf
|
||||
cp %{buildroot}%{_datadir}/libalternatives/iptables/2.conf %{buildroot}%{_datadir}/libalternatives/ip6tables/2.conf
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ip6tables-restore
|
||||
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
|
||||
for i in ip6tables ip6tables-restore ip6tables-save iptables-restore iptables-save; do
|
||||
mkdir -pv "$b/%_datadir/libalternatives/$i"
|
||||
cp -av "$b/%_datadir/libalternatives/iptables/"*.conf "$b/%_datadir/libalternatives/$i/"
|
||||
done
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/arptables/2.conf <<EOF
|
||||
binary=%{_sbindir}/xtables-nft-multi
|
||||
group=arptables, arptables-restore, arptables-save
|
||||
mkdir -pv $b/%_datadir/libalternatives/arptables
|
||||
cat >"$b/%_datadir/libalternatives/arptables/2.conf" <<-EOF
|
||||
binary=%_sbindir/xtables-nft-multi
|
||||
group=arptables, arptables-restore, arptables-save
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables-restore
|
||||
cp %{buildroot}%{_datadir}/libalternatives/arptables/2.conf %{buildroot}%{_datadir}/libalternatives/arptables-restore/2.conf
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/arptables-save
|
||||
cp %{buildroot}%{_datadir}/libalternatives/arptables/2.conf %{buildroot}%{_datadir}/libalternatives/arptables-save/2.conf
|
||||
for i in arptables-restore arptables-save; do
|
||||
mkdir -pv "$b/%_datadir/libalternatives/$i"
|
||||
cp -av "$b/%_datadir/libalternatives/arptables/2.conf" "$b/%_datadir/libalternatives/$i/"
|
||||
done
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf <<EOF
|
||||
binary=%{_sbindir}/xtables-nft-multi
|
||||
group=ebtables, ebtables-restore, ebtables-save
|
||||
mkdir -p "$b/%_datadir/libalternatives/ebtables"
|
||||
cat >"$b/%_datadir/libalternatives/ebtables/2.conf" <<-EOF
|
||||
binary=%_sbindir/xtables-nft-multi
|
||||
group=ebtables, ebtables-restore, ebtables-save
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-restore
|
||||
cp %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf %{buildroot}%{_datadir}/libalternatives/ebtables-restore/2.conf
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/ebtables-save
|
||||
cp %{buildroot}%{_datadir}/libalternatives/ebtables/2.conf %{buildroot}%{_datadir}/libalternatives/ebtables-save/2.conf
|
||||
for i in ebtables-restore ebtables-save; do
|
||||
mkdir -pv "$b/%_datadir/libalternatives/$i"
|
||||
cp -av "$b/%_datadir/libalternatives/ebtables/2.conf" "$b/%_datadir/libalternatives/$i/"
|
||||
done
|
||||
|
||||
%endif
|
||||
|
||||
@ -261,6 +250,7 @@ if [ "$1" > 0 ] ; then
|
||||
update-alternatives --remove iptables "%_sbindir/xtables-legacy-multi"
|
||||
fi
|
||||
%else
|
||||
|
||||
%post
|
||||
update-alternatives \
|
||||
--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"
|
||||
fi
|
||||
%else
|
||||
|
||||
%post backend-nft
|
||||
update-alternatives \
|
||||
--install "%_sbindir/iptables" iptables "%_sbindir/xtables-nft-multi" 2 \
|
||||
@ -342,19 +333,7 @@ fi
|
||||
%ghost %_sysconfdir/alternatives/ip6tables-restore
|
||||
%ghost %_sysconfdir/alternatives/ip6tables-save
|
||||
%else
|
||||
%dir %{_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
|
||||
%_datadir/libalternatives/
|
||||
%endif
|
||||
%_sbindir/iptables
|
||||
%_sbindir/iptables-restore
|
||||
@ -378,31 +357,7 @@ fi
|
||||
%ghost %_sysconfdir/alternatives/ebtables-restore
|
||||
%ghost %_sysconfdir/alternatives/ebtables-save
|
||||
%else
|
||||
%dir %{_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
|
||||
%_datadir/libalternatives/
|
||||
%endif
|
||||
%_sbindir/iptables
|
||||
%_sbindir/iptables-restore
|
||||
|
Loading…
Reference in New Issue
Block a user