Author: blogic
Date: 2014-06-26 13:43:42 +0200 (Thu, 26 Jun 2014)
New Revision: 41347

Modified:
   trunk/scripts/ubinize-image.sh
Log:
scripts/ubinize-image.sh: fix parameter handling

ubinize-image.sh previously used ${var:offset:length} substitutions
which are not valid in standard shell.
Replace the existing parameter matching by a case ... esac expression.

Signed-off-by: Daniel Golle <[email protected]>

Modified: trunk/scripts/ubinize-image.sh
===================================================================
--- trunk/scripts/ubinize-image.sh      2014-06-26 11:43:38 UTC (rev 41346)
+++ trunk/scripts/ubinize-image.sh      2014-06-26 11:43:42 UTC (rev 41347)
@@ -57,36 +57,39 @@
 }
 
 while [ "$1" ]; do
-       if [ "$1" = "--uboot-env" ]; then
+       case "$1" in
+       "--uboot-env")
                ubootenv="ubootenv"
                shift
                continue
-       fi
-       if [ "$1" = "--no-kernel" ]; then
+               ;;
+       "--no-kernel")
                nokernel="nokernel"
                shift
                continue
-       fi
-       if [ ! "$kernel" -a ! "$nokernel" ]; then
-               [ "${1:0:1}" = "-" ] && break
-               kernel=$1
-               shift
-               continue
-       fi
-       if [ ! "$rootfs" ]; then
-               [ "${1:0:1}" = "-" ] && break
-               rootfs=$1
-               shift
-               continue
-       fi
-       if [ ! "$outfile" ]; then
-               [ "${1:0:1}" = "-" ] && break
-               outfile=$1
-               shift
-               continue
-       fi
-       ubinize_param="$@"
-       break
+               ;;
+       "-"*)
+               ubinize_param="$@"
+               break
+               ;;
+       *)
+               if [ ! "$kernel" -a ! "$nokernel" ]; then
+                       kernel=$1
+                       shift
+                       continue
+               fi
+               if [ ! "$rootfs" ]; then
+                       rootfs=$1
+                       shift
+                       continue
+               fi
+               if [ ! "$outfile" ]; then
+                       outfile=$1
+                       shift
+                       continue
+               fi
+               ;;
+       esac
 done
 
 if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$nokernel" -o ! "$outfile" ]; then
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to