- replaced ebtables-save perl script by bash script to get rid of the perl

requirement
This commit is contained in:
Thomas Woerner 2012-02-16 16:01:42 +01:00
parent 56169b806b
commit accea79eaa
2 changed files with 53 additions and 1 deletions

43
ebtables-save Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
EBTABLES="/sbin/ebtables"
[ -x "$EBTABLES" ] || exit 1
echo "# Generated by ebtables-save v1.0 on $(date)"
cnt=""
[ "x$EBTABLES_SAVE_COUNTER" = "xyes" ] && cnt="--Lc"
for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do
table=$($EBTABLES -t $table_name -L $cnt)
[ $? -eq 0 ] || { echo "$table"; exit -1; }
chain=""
rules=""
while read line; do
[ -z "$line" ] && continue
case "$line" in
Bridge\ table:\ *)
echo "*${line:14}"
;;
Bridge\ chain:\ *)
chain="${line:14}"
chain="${chain%%,*}"
policy="${line##*policy: }"
echo ":$chain $policy"
;;
*)
if [ "$cnt" = "--Lc" ]; then
line=${line/, pcnt \=/ -c}
line=${line/-- bcnt \=/}
fi
rules="$rules-A $chain $line\n"
;;
esac
done <<EOF
$table
EOF
echo -e $rules
done

View File

@ -1,11 +1,12 @@
Name: ebtables
Version: 2.0.10
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Ethernet Bridge frame table administration tool
License: GPLv2+
Group: System Environment/Base
URL: http://ebtables.sourceforge.net/
Source0: http://downloads.sourceforge.net/ebtables/ebtables-v%{version}-2.tar.gz
Source1: ebtables-save
Requires(pre): /sbin/chkconfig
Requires(postun): /sbin/service
Patch0: ebtables-2.0.10-norootinst.patch
@ -42,6 +43,10 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ebtables.filter
touch $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ebtables.nat
touch $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ebtables.broute
# install ebtables-save bash script
rm -f $RPM_BUILD_ROOT/sbin/ebtables-save
install %{SOURCE1} $RPM_BUILD_ROOT/sbin/ebtables-save
%post
/sbin/chkconfig --add ebtables
/sbin/ldconfig
@ -72,6 +77,10 @@ fi
%ghost %{_sysconfdir}/sysconfig/ebtables.broute
%changelog
* Thu Feb 16 2012 Thomas Woerner <twoerner@redhat.com> - 2.0.10-4
- replaced ebtables-save perl script by bash script to get rid of the perl
requirement
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild