[ebtables] - replaced ebtables-save perl script by bash script to get rid of the perl requirement
Thomas Woerner
twoerner at fedoraproject.org
Thu Feb 16 15:02:17 UTC 2012
commit accea79eaae721d0555f188830b83c4d2985de6a
Author: Thomas Woerner <twoerner at redhat.com>
Date: Thu Feb 16 16:01:42 2012 +0100
- replaced ebtables-save perl script by bash script to get rid of the perl
requirement
ebtables-save | 43 +++++++++++++++++++++++++++++++++++++++++++
ebtables.spec | 11 ++++++++++-
2 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/ebtables-save b/ebtables-save
new file mode 100755
index 0000000..2d7fc4e
--- /dev/null
+++ b/ebtables-save
@@ -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
diff --git a/ebtables.spec b/ebtables.spec
index 7d7444a..09301b5 100644
--- a/ebtables.spec
+++ b/ebtables.spec
@@ -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 at 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 at lists.fedoraproject.org> - 2.0.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list