summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2013-06-06 14:53:29 +0800
committerSaul Wold <sgw@linux.intel.com>2013-06-10 14:51:25 -0700
commit4c6f7a5d8bd6ada434b91037ecd5db06f3eac814 (patch)
treef4b474aa333696ccb08b27b019ba1f694ac907bf /scripts
parent79bd773cc5e8b8e873cabeb2b9a91f460501dad7 (diff)
downloadopenembedded-core-4c6f7a5d8bd6ada434b91037ecd5db06f3eac814.tar.gz
openembedded-core-4c6f7a5d8bd6ada434b91037ecd5db06f3eac814.tar.bz2
openembedded-core-4c6f7a5d8bd6ada434b91037ecd5db06f3eac814.zip
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] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/contrib/ddimage16
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index 956699c05d..ab1d4c7b10 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"