[oe-commits] [meta-openembedded] 11/39: ebtables: replace ebtables-save perl script with bash rewrite

git at git.openembedded.org git at git.openembedded.org
Sun Aug 13 11:29:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

martin_jansa pushed a commit to branch master-next
in repository meta-openembedded.

commit ab4774ea8b3290fafcc7cf1c29e068a65344c8f1
Author: Andre McCurdy <armccurdy at gmail.com>
AuthorDate: Tue Jul 11 10:09:11 2017 -0700

    ebtables: replace ebtables-save perl script with bash rewrite
    
    Fedora provides a bash replacement for the default ebtables-save perl
    script. Using it allows the ebtables run-time dependency on perl to
    be replaced with a runtime dependency on bash - which is lower
    overhead and more likely to be present on typical embedded systems
    already.
    
      https://bugzilla.redhat.com/show_bug.cgi?id=746040
      http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save
    
    Since ebtables-save no longer contains a references to /usr, the
    previous QA issue workaround of moving it from ${base_sbindir} to
    ${sbindir} is no longer required.
    
      http://git.openembedded.org/meta-openembedded/commit/?id=a7c6fcebee7d9f86c356ea92de445d89e714ff62
    
    Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
    Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
 .../ebtables/ebtables-2.0.10-4/ebtables-save       | 43 ++++++++++++++++++++++
 .../recipes-filter/ebtables/ebtables_2.0.10-4.bb   | 15 ++++----
 2 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save b/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save
new file mode 100755
index 0000000..2d7fc4e
--- /dev/null
+++ b/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/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/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb b/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
index 375423d..e724731 100644
--- a/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
+++ b/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
@@ -4,14 +4,15 @@ DESCRIPTION = "Utility for basic Ethernet frame filtering on a Linux bridge, \
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
 SECTION = "net"
-PR = "r3"
+PR = "r4"
 
-RDEPENDS_${PN} += "perl"
+RDEPENDS_${PN} += "bash"
 
 RRECOMMENDS_${PN} += "kernel-module-ebtables \
     "
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/ebtables/ebtables-v${PV}.tar.gz \
+           file://ebtables-save \
            file://installnonroot.patch \
            file://01debian_defaultconfig.patch \
            file://ebtables.init \
@@ -78,12 +79,10 @@ do_install () {
     mv ${D}${sysconfdir}/default/ebtables-config ${D}${sysconfdir}/default/ebtables
     sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ebtables
 
-    # The script ebtables-save refernces perl in exec_prefix, so
-    # move it to sbindir to avoid QA issue
-    if ${base_sbindir} != ${sbindir} ; then
-       install -d ${D}/${sbindir}
-       mv ${D}/${base_sbindir}/ebtables-save ${D}/${sbindir}
-    fi
+    # Replace upstream ebtables-save perl script with Fedora bash based rewrite
+    # http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save
+    install -m 0755 ${WORKDIR}/ebtables-save ${D}${base_sbindir}/ebtables-save
+    sed -i 's!/sbin/!${base_sbindir}/!g' ${D}${base_sbindir}/ebtables-save
 
     # Install systemd service files
     install -d ${D}${systemd_unitdir}/system

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list