Patchwork [1/1] scripts/runqemu: Fix MACHINE regex

login
register
mail settings
Submitter Mihai Prica
Date Sept. 2, 2013, 12:50 p.m.
Message ID <0a128d4a040bc934645cf69cdfaef15c4a518801.1378125322.git.mihai.prica@intel.com>
Download mbox | patch
Permalink /patch/57221/
State Accepted
Commit 22c0668d9e0a22c095d78bab7b45ef4f803dd0d1
Headers show

Comments

Mihai Prica - Sept. 2, 2013, 12:50 p.m.
When runqemu tries to determine the MACHINE variable from a
kernel or vmdk filename that doesn't contain any known machine
name, the variable gets set to the filename. It should remain
unset and cause an error.

[YOCTO #2890]

Signed-off-by: Mihai Prica <mihai.prica@intel.com>
---
 scripts/runqemu |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index 04dc3b0..b496785 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -224,13 +224,13 @@  fi
 
 if [ -z "$MACHINE" ]; then
     if [ "x$FSTYPE" = "xvmdk" ]; then
-        MACHINE=`basename $VM | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'`
+        MACHINE=`basename $VM | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
         if [ -z "$MACHINE" ]; then
             error "Unable to set MACHINE from vmdk filename [$VM]"
         fi
         echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]"
     else
-        MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'`
+        MACHINE=`basename $KERNEL | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
         if [ -z "$MACHINE" ]; then
             error "Unable to set MACHINE from kernel filename [$KERNEL]"
         fi