From: Hongxu Jia Date: Thu, 6 Jun 2013 06:53:29 +0000 (+0800) Subject: ddimage: fix incompatibility with dash X-Git-Tag: rev_ivi_2015_02_04~12251 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a46362b2023abf93592fd4627e1435f74bcec557;p=scm%2Fbb%2Ftizen-distro.git ddimage: fix incompatibility with dash On systems with dash as /bin/sh there were failures while invoking ddimage. Fix to let it work with both bash and dash shells. [YOCTO #4617] (From OE-Core rev: 4c6f7a5d8bd6ada434b91037ecd5db06f3eac814) Signed-off-by: Hongxu Jia Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage index 956699c..ab1d4c7 100755 --- a/scripts/contrib/ddimage +++ b/scripts/contrib/ddimage @@ -6,11 +6,11 @@ BLACKLIST_DEVICES="/dev/sda" # 1MB blocksize BLOCKSIZE=1048576 -function usage() { +usage() { echo "Usage: $(basename $0) IMAGE DEVICE" } -function image_details() { +image_details() { IMG=$1 echo "Image details" echo "=============" @@ -21,7 +21,7 @@ function image_details() { echo "" } -function device_details() { +device_details() { DEV=$1 BLOCK_SIZE=512 @@ -61,10 +61,12 @@ if [ ! -e "$IMAGE" ]; then fi -if [ "${BLACKLIST_DEVICES/${DEVICE}/ERROR}" != "$BLACKLIST_DEVICES" ]; then - echo "ERROR: Device $DEVICE is blacklisted" - exit 1 -fi +for i in ${BLACKLIST_DEVICES}; do + if [ "$i" = "$DEVICE" ]; then + echo "ERROR: Device $DEVICE is blacklisted" + exit 1 + fi +done if [ ! -w "$DEVICE" ]; then echo "ERROR: Device $DEVICE does not exist or is not writable"