mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-04-02 02:49:12 +00:00
ebtables: Remove the dependecy on bash
Rewrite ebtables-legacy-save to avoid using bashisms. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
parent
6851cbf026
commit
ce59141da8
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
EBTABLES="/usr/sbin/ebtables-legacy"
|
EBTABLES="/usr/sbin/ebtables-legacy"
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ cnt=""
|
|||||||
|
|
||||||
for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do
|
for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do
|
||||||
table=$($EBTABLES -t $table_name -L $cnt)
|
table=$($EBTABLES -t $table_name -L $cnt)
|
||||||
[ $? -eq 0 ] || { echo "$table"; exit -1; }
|
[ $? -eq 0 ] || { echo "$table"; exit 1; }
|
||||||
|
|
||||||
chain=""
|
chain=""
|
||||||
rules=""
|
rules=""
|
||||||
@ -20,24 +20,23 @@ for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/eb
|
|||||||
|
|
||||||
case "$line" in
|
case "$line" in
|
||||||
Bridge\ table:\ *)
|
Bridge\ table:\ *)
|
||||||
echo "*${line:14}"
|
echo "*${line#Bridge table: }"
|
||||||
;;
|
;;
|
||||||
Bridge\ chain:\ *)
|
Bridge\ chain:\ *)
|
||||||
chain="${line:14}"
|
chain="${line#Bridge chain: }"
|
||||||
chain="${chain%%,*}"
|
chain="${chain%%,*}"
|
||||||
policy="${line##*policy: }"
|
policy="${line##*policy: }"
|
||||||
echo ":$chain $policy"
|
echo ":$chain $policy"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$cnt" = "--Lc" ]; then
|
[ "$cnt" != "--Lc" ] ||
|
||||||
line=${line/, pcnt \=/ -c}
|
line=$(echo "$line" | sed -e 's/, pcnt =/-c/' -e 's/ -- bcnt =//')
|
||||||
line=${line/-- bcnt \=/}
|
rules="$rules-A $chain $line
|
||||||
fi
|
"
|
||||||
rules="$rules-A $chain $line\n"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <<EOF
|
done <<EOF
|
||||||
$table
|
$table
|
||||||
EOF
|
EOF
|
||||||
echo -e $rules
|
echo "$rules"
|
||||||
done
|
done
|
||||||
|
|||||||
@ -6,8 +6,6 @@ LICENSE = "GPL-2.0-only"
|
|||||||
LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
|
LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
|
||||||
SECTION = "net"
|
SECTION = "net"
|
||||||
|
|
||||||
RDEPENDS:${PN} += "bash"
|
|
||||||
|
|
||||||
RRECOMMENDS:${PN} += "kernel-module-ebtables \
|
RRECOMMENDS:${PN} += "kernel-module-ebtables \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user