1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

runqemu: be sh neutral

Now runs with dash and busybox' ash as well as with bash

(From OE-Core rev: 2b93ed90736ed08c25561e24343a5ef2b8f7dbef)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Bernhard Reutner-Fischer
2012-05-03 19:12:34 +02:00
committed by Richard Purdie
parent 56f243e4ce
commit c048ff9f9d
2 changed files with 16 additions and 13 deletions
+8 -5
View File
@@ -91,10 +91,9 @@ process_filename() {
# Parse command line args without requiring specific ordering. It's a # Parse command line args without requiring specific ordering. It's a
# bit more complex, but offers a great user experience. # bit more complex, but offers a great user experience.
KVM_ENABLED="no" KVM_ENABLED="no"
i=1 while true; do
while [ $i -le $# ]; do arg=${1}
arg=${!i} case "$arg" in
case $arg in
"qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc") "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc")
[ -z "$MACHINE" ] && MACHINE=$arg || \ [ -z "$MACHINE" ] && MACHINE=$arg || \
error "conflicting MACHINE types [$MACHINE] and [$arg]" error "conflicting MACHINE types [$MACHINE] and [$arg]"
@@ -152,6 +151,7 @@ while [ $i -le $# ]; do
KVM_ENABLED="yes" KVM_ENABLED="yes"
KVM_CAPABLE=`grep -q 'vmx\|smx' /proc/cpuinfo && echo 1` KVM_CAPABLE=`grep -q 'vmx\|smx' /proc/cpuinfo && echo 1`
;; ;;
"") break ;;
*) *)
# A directory name is an nfs rootfs # A directory name is an nfs rootfs
if [ -d "$arg" ]; then if [ -d "$arg" ]; then
@@ -174,7 +174,7 @@ while [ $i -le $# ]; do
fi fi
;; ;;
esac esac
i=$((i + 1)) shift
done done
if [ ! -c /dev/net/tun ] ; then if [ ! -c /dev/net/tun ] ; then
@@ -391,6 +391,9 @@ if [ "$libgl" != 'yes' ]; then
exit 1; exit 1;
fi fi
INTERNAL_SCRIPT="$0-internal"
if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
INTERNAL_SCRIPT=`which runqemu-internal` INTERNAL_SCRIPT=`which runqemu-internal`
fi
. $INTERNAL_SCRIPT . $INTERNAL_SCRIPT
+8 -8
View File
@@ -69,7 +69,7 @@ QEMU_MEMORY="$mem_size"M
# Bug 433: qemuarm cannot use > 256 MB RAM # Bug 433: qemuarm cannot use > 256 MB RAM
if [ "$MACHINE" = "qemuarm" ]; then if [ "$MACHINE" = "qemuarm" ]; then
if [[ -z "$mem_size" || $mem_size -gt 256 ]]; then if [ -z "$mem_size" -o $mem_size -gt 256 ]; then
echo "WARNING: qemuarm does not support > 256M of RAM." echo "WARNING: qemuarm does not support > 256M of RAM."
echo "Changing QEMU_MEMORY to default of 256M." echo "Changing QEMU_MEMORY to default of 256M."
QEMU_MEMORY="256M" QEMU_MEMORY="256M"
@@ -111,7 +111,7 @@ acquire_lock() {
if [ -e "$lockfile.lock" ]; then if [ -e "$lockfile.lock" ]; then
# Check that the lockfile is not stale # Check that the lockfile is not stale
ps=`ps -ewwo pid | grep $(cat $lockfile.lock)` ps=`ps -eo pid | grep $(cat $lockfile.lock)`
if [ -z "$ps" ]; then if [ -z "$ps" ]; then
echo "WARNING: Stale lock file detected, deleting $lockfile.lock." echo "WARNING: Stale lock file detected, deleting $lockfile.lock."
rm -f $lockfile.lock rm -f $lockfile.lock
@@ -212,8 +212,9 @@ cleanup() {
stty sane stty sane
} }
n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] n0=$(echo $TAP | sed 's/tap//')
n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] n1=$(($n0 * 2 + 1))
n2=$(($n1 + 1))
KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
@@ -437,7 +438,7 @@ if [ ! -x "$QEMUBIN" ]; then
return return
fi fi
function _quit() { do_quit() {
if [ -n "$PIDFILE" ]; then if [ -n "$PIDFILE" ]; then
#echo kill `cat $PIDFILE` #echo kill `cat $PIDFILE`
kill `cat $PIDFILE` kill `cat $PIDFILE`
@@ -449,7 +450,7 @@ function _quit() {
DISTCCD=`which distccd 2> /dev/null` DISTCCD=`which distccd 2> /dev/null`
PIDFILE="" PIDFILE=""
trap _quit INT TERM QUIT trap do_quit INT TERM QUIT
if [ -x "$DISTCCD" ]; then if [ -x "$DISTCCD" ]; then
echo "Starting distccd..." echo "Starting distccd..."
@@ -476,7 +477,7 @@ if grep -i ubuntu /etc/lsb-release &> /dev/null
then then
# precede nvidia's driver on Ubuntu 10 # precede nvidia's driver on Ubuntu 10
UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1` UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1`
if [ $UBUNTU_MAIN_VERSION -eq 10 ]; if [ "$UBUNTU_MAIN_VERSION" = "10" ];
then then
GL_PATH="" GL_PATH=""
if test -e /usr/lib/libGL.so if test -e /usr/lib/libGL.so
@@ -502,4 +503,3 @@ LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -n
cleanup cleanup
trap - INT TERM QUIT trap - INT TERM QUIT
return