scripts/runqemu-ifup: Fix extra parameter issue
PATCH 1/2 scripts/runqemu-ifup: Fix extra parameter issue
The third parameter was dropped in a previous commit but changes were not made to the argument checks. Fix this.
Signed-off-by Richard Purdie <[email protected]>
--- scripts/runqemu-ifup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/runqemu-ifup +2 -2
@@ -21,7 +21,7 @@ # usage() { - echo "sudo $(basename $0) <uid> <gid> <native-sysroot-basedir>" + echo "sudo $(basename $0) <uid> <gid>" } if [ $EUID -ne 0 ]; then
@@ -29,7 +29,7 @@ if [ $EUID -ne 0 ]; then exit 1 fi -if [ $# -ne 3 ]; then +if [ $# -ne 2 ]; then usage exit 1 fi
Signature · 1 line
2.39.2
PATCH 2/2 scripts/runqemu-ifup: Fix 10 or more tap devices
The use of sort means that tap10 and tap1 don't sort correctly. Tweak the shell expression to correctly handle numbers of tap devices of 10 or more.
Signed-off-by Richard Purdie <[email protected]>
--- scripts/runqemu-ifup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/runqemu-ifup +1 -1
@@ -38,7 +38,7 @@ USERID="-u $1" GROUP="-g $2" if taps=$(ip tuntap list 2>/dev/null); then - tap_no=$(( $(echo "$taps" |sort -r |sed 's/^tap//; s/:.*//; q') + 1 )) + tap_no=$(( $(echo "$taps" |cut -f 1 -d ":" | sed 's/tap//g' | sort -rn | head -n 1) + 1 )) ip tuntap add tap$tap_no mode tap group $2 && TAP=tap$tap_no fi
Signature · 1 line
2.39.2