]> code.ossystems Code Review - openembedded-core.git/commitdiff
runqemu: simplify process_filename()
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Thu, 3 May 2012 17:12:31 +0000 (19:12 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 May 2012 08:54:46 +0000 (09:54 +0100)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/runqemu

index 18fd6918730817a3b5144ab44530f0157e8d839e..dfa7f4bc2dc396253afe55ed93b5d2a4f765849e 100755 (executable)
@@ -62,28 +62,31 @@ process_filename() {
 
     # Extract the filename extension
     EXT=`echo $filename | awk -F . '{ print \$NF }'`
-    # A file ending in .bin is a kernel
-    if [ "x$EXT" = "xbin" ]; then
-        if [ -z "$KERNEL" ]; then
-            KERNEL=$filename
-        else
-            echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
-            usage
-        fi
-    elif [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
-            "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
-        # A file ending in a supportted fs type is a rootfs image
-        if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
-            FSTYPE=$EXT
-            ROOTFS=$filename
-        else
-            echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
-            usage
-        fi
-    else
-       echo "Error: unknown file arg [$filename]"
-       usage
-    fi
+    case /$EXT/ in
+       /bin/)
+               # A file ending in .bin is a kernel
+               if [ -z "$KERNEL" ]; then
+                   KERNEL=$filename
+               else
+                   echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
+                   usage
+               fi
+               ;;
+       /ext[234]/|/jffs2/|/btrfs/)
+               # A file ending in a supportted fs type is a rootfs image
+               if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
+                   FSTYPE=$EXT
+                   ROOTFS=$filename
+               else
+                   echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
+                   usage
+               fi
+               ;;
+       *)
+               echo "Error: unknown file arg [$filename]"
+               usage
+               ;;
+    esac
 }
 
 # Parse command line args without requiring specific ordering. It's a