diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-06-26 15:29:26 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-28 07:56:34 +0100 |
commit | 95c785baeb60c750352873a190da34ed0b362569 (patch) | |
tree | f2f32592dd5258fcbbbbd7795492e4dfef4422b6 /scripts/runqemu-ifdown | |
parent | abeb4f1a7c7cec22c578fdc07f6125714559206b (diff) | |
download | poky-95c785baeb60c750352873a190da34ed0b362569.tar.gz |
runqemu-ifdown: catch up with ifup
- Drop the native-sysroot-basedir parameter
still allow it to keep backward compatibility
write a warning to stderr
- Add a space after ! in the if as suggested by shellcheck
- Support the new OE_TAP_NAME variable as well
(From OE-Core rev: be72e5e32da5a251db14b42d3e9c0951178e216d)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-ifdown')
-rwxr-xr-x | scripts/runqemu-ifdown | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown index 78be28812d..822a2a39b9 100755 --- a/scripts/runqemu-ifdown +++ b/scripts/runqemu-ifdown | |||
@@ -16,7 +16,7 @@ | |||
16 | # | 16 | # |
17 | 17 | ||
18 | usage() { | 18 | usage() { |
19 | echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>" | 19 | echo "sudo $(basename $0) <tap-dev>" |
20 | } | 20 | } |
21 | 21 | ||
22 | if [ $EUID -ne 0 ]; then | 22 | if [ $EUID -ne 0 ]; then |
@@ -24,15 +24,19 @@ if [ $EUID -ne 0 ]; then | |||
24 | exit 1 | 24 | exit 1 |
25 | fi | 25 | fi |
26 | 26 | ||
27 | if [ $# -ne 2 ]; then | 27 | if [ $# -gt 2 ] || [ $# -lt 1 ]; then |
28 | usage | 28 | usage |
29 | exit 1 | 29 | exit 1 |
30 | fi | 30 | fi |
31 | 31 | ||
32 | # backward compatibility | ||
33 | if [ $# -eq 2 ] ; then | ||
34 | echo "Warning: native-sysroot-basedir parameter is ignored. It is no longer needed." >&2 | ||
35 | fi | ||
36 | |||
32 | TAP=$1 | 37 | TAP=$1 |
33 | STAGING_BINDIR_NATIVE=$2 | ||
34 | 38 | ||
35 | if !ip tuntap del $TAP mode tap 2>/dev/null; then | 39 | if ! ip tuntap del $TAP mode tap 2>/dev/null; then |
36 | echo "Error: Unable to run up tuntap del" | 40 | echo "Error: Unable to run up tuntap del" |
37 | exit 1 | 41 | exit 1 |
38 | fi | 42 | fi |
@@ -56,8 +60,13 @@ if [ ! -x "$IPTABLES" ]; then | |||
56 | echo "$IPTABLES cannot be executed" | 60 | echo "$IPTABLES cannot be executed" |
57 | exit 1 | 61 | exit 1 |
58 | fi | 62 | fi |
59 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 63 | |
60 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | 64 | if [ -z "$OE_TAP_NAME" ]; then |
65 | OE_TAP_NAME=tap | ||
66 | fi | ||
67 | |||
68 | n=$[ (`echo $TAP | sed "s/$OE_TAP_NAME//"` * 2) + 1 ] | ||
69 | dest=$[ (`echo $TAP | sed "s/$OE_TAP_NAME//"` * 2) + 2 ] | ||
61 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 | 70 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 |
62 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 | 71 | $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 |
63 | true | 72 | true |