diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-21 11:35:01 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-21 11:35:01 +0000 |
commit | e121f9eb5998ea285edad902b689d16a4a2aee53 (patch) | |
tree | df0318e6a704645ce3427f7cd4a4c844c0c33e07 | |
parent | 0e2243313057d84c5d1292b83473797c5a581474 (diff) | |
download | openembedded-core-e121f9eb5998ea285edad902b689d16a4a2aee53.tar.gz openembedded-core-e121f9eb5998ea285edad902b689d16a4a2aee53.tar.bz2 openembedded-core-e121f9eb5998ea285edad902b689d16a4a2aee53.zip |
scripts/runqemu: Factor image location code into a shell function
-rwxr-xr-x | scripts/runqemu | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index d0abe56f57..7d5107f144 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -72,17 +72,32 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o CROSSPATH=$BUILDDIR/tmp/cross/arm-poky-linux-gnueabi/bin fi +function findimage { + where=$1 + machine=$2 + extension=$3 + names=$4 + for name in $names; + do + fullname=$where/$name-$machine.$extension + if [ -e "$fullname" ]; then + HDIMAGE=$fullname + return + fi + done + echo "Couldn't find image in $where. Attempted image names were:" + for name in $names; + do + echo $name-$machine.$extension + done + exit 1 +} + if [ "$MACHINE" = "qemuarm" ]; then if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images/poky-image - if [ -e "$T-sdk-qemuarm.ext3" ]; then - HDIMAGE="$T-sdk-qemuarm.ext3" - elif [ -e "$T-sato-qemuarm.ext3" ]; then - HDIMAGE="$T-sato-qemuarm.ext3" - elif [ -e "$T-minimal-qemuarm.ext3" ]; then - HDIMAGE="$T-minimal-qemuarm.ext3" - fi + T=$BUILDDIR/tmp/deploy/images + findimage $T qemuarm ext3 "poky-image-sdk poky-image-sato poky-image-minimal" fi fi fi @@ -118,14 +133,8 @@ if [ "$MACHINE" = "qemux86" ]; then fi if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images/poky-image - if [ -e "$T-sdk-qemux86.ext3" ]; then - HDIMAGE=$T-sdk-qemux86.ext3 - elif [ -e "$T-sato-qemux86.ext3" ]; then - HDIMAGE=$T-sato-qemux86.ext3 - elif [ -e "$T-minimal-qemux86.ext3" ]; then - HDIMAGE=$T-minimal-qemux86.ext3 - fi + T=$BUILDDIR/tmp/deploy/images + findimage $T qemux86 ext3 "poky-image-sdk poky-image-sato poky-image-minimal moblin-image-netbook" fi fi CROSSPATH=$BUILDDIR/tmp/cross/i586-poky-linux/bin |