runqemu: use modern, single-char name of test(1)

I do not have "[[", just "[". Be gentle to users of legacy-free setups,
also by using '=' instead of the double notation.

(From OE-Core rev: e96ba42a977f4c07aa196ce379ecd73e4ddc23c5)

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:30 +02:00 committed by Richard Purdie
parent 97482d61cf
commit e99f652ede
1 changed files with 23 additions and 23 deletions

View File

@ -70,10 +70,10 @@ process_filename() {
echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]" echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
usage usage
fi fi
elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || elif [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
"x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
# A file ending in a supportted fs type is a rootfs image # A file ending in a supportted fs type is a rootfs image
if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
FSTYPE=$EXT FSTYPE=$EXT
ROOTFS=$filename ROOTFS=$filename
else else
@ -102,7 +102,7 @@ while [ $i -le $# ]; do
fi fi
;; ;;
"ext2" | "ext3" | "jffs2" | "nfs" | "btrfs") "ext2" | "ext3" | "jffs2" | "nfs" | "btrfs")
if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then if [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ]; then
FSTYPE=$arg FSTYPE=$arg
else else
echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
@ -143,7 +143,7 @@ while [ $i -le $# ]; do
# to use simplified options instead # to use simplified options instead
serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'` serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'` kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then if [ ! -z "$serial_option" -o ! -z "$kvm_option" ]; then
echo "Error: Please use simplified serial or kvm options instead" echo "Error: Please use simplified serial or kvm options instead"
usage usage
fi fi
@ -152,7 +152,7 @@ while [ $i -le $# ]; do
SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}" SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
;; ;;
"audio") "audio")
if [[ "x$MACHINE" == "xqemux86" || "x$MACHINE" == "xqemux86-64" ]]; then if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest."; echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest.";
QEMU_AUDIO_DRV="alsa" QEMU_AUDIO_DRV="alsa"
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370" SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
@ -166,7 +166,7 @@ while [ $i -le $# ]; do
# A directory name is an nfs rootfs # A directory name is an nfs rootfs
if [ -d "$arg" ]; then if [ -d "$arg" ]; then
echo "Assuming $arg is an nfs rootfs" echo "Assuming $arg is an nfs rootfs"
if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
FSTYPE=nfs FSTYPE=nfs
else else
echo "Error: conflicting FSTYPE types [$arg] and nfs" echo "Error: conflicting FSTYPE types [$arg] and nfs"
@ -200,13 +200,13 @@ fi
YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
# Detect KVM configuration # Detect KVM configuration
if [[ "x$KVM_ENABLED" == "xyes" ]]; then if [ "x$KVM_ENABLED" = "xyes" ]; then
if [[ -z "$KVM_CAPABLE" ]]; then if [ -z "$KVM_CAPABLE" ]; then
echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer"; echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
echo "$YOCTO_KVM_WIKI"; echo "$YOCTO_KVM_WIKI";
exit 1; exit 1;
fi fi
if [[ "x$MACHINE" != "xqemux86" && "x$MACHINE" != "xqemux86-64" ]]; then if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
echo "KVM only support x86 & x86-64. Remove kvm from the command-line"; echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
exit 1; exit 1;
fi fi
@ -225,11 +225,11 @@ if [[ "x$KVM_ENABLED" == "xyes" ]]; then
fi fi
# Report errors for missing combinations of options # Report errors for missing combinations of options
if [[ -z "$MACHINE" && -z "$KERNEL" ]]; then if [ -z "$MACHINE" -a -z "$KERNEL" ]; then
echo "Error: you must specify at least a MACHINE or KERNEL argument" echo "Error: you must specify at least a MACHINE or KERNEL argument"
usage usage
fi fi
if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
echo "Error: NFS booting without an explicit ROOTFS path is not yet supported" echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
usage usage
fi fi
@ -313,11 +313,11 @@ findimage() {
# recently created one is the one we most likely want to boot. # recently created one is the one we most likely want to boot.
filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs` filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
for name in $filenames; do for name in $filenames; do
if [[ "$name" =~ core-image-sato-sdk || if [ "$name" =~ core-image-sato-sdk -o \
"$name" =~ core-image-sato || "$name" =~ core-image-sato -o \
"$name" =~ core-image-lsb || "$name" =~ core-image-lsb -o \
"$name" =~ core-image-basic || "$name" =~ core-image-basic -o \
"$name" =~ core-image-minimal ]]; then "$name" =~ core-image-minimal ]; then
ROOTFS=$name ROOTFS=$name
return return
fi fi
@ -327,11 +327,11 @@ findimage() {
exit 1 exit 1
} }
if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
# Extract the filename extension # Extract the filename extension
EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
"x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
FSTYPE=$EXT FSTYPE=$EXT
else else
echo "Note: Unable to determine filesystem extension for $ROOTFS" echo "Note: Unable to determine filesystem extension for $ROOTFS"
@ -396,9 +396,9 @@ setup_sysroot
# We can't run without a libGL.so # We can't run without a libGL.so
libgl='no' libgl='no'
test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes' [ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes'
test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes' [ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes'
test -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so && libgl='yes' [ -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so ] && libgl='yes'
if [ "$libgl" != 'yes' ]; then if [ "$libgl" != 'yes' ]; then
echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator. echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.