diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2013-06-06 14:53:29 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-07-09 10:53:50 +0100 |
commit | 59ab44fb3e4f5acba5000a1e27eef1b6cc1010b8 (patch) | |
tree | fda0a65a80d8d15527b4b531b52b289cd24e2abd /scripts/contrib/ddimage | |
parent | e4a0a4c5e419154a34710a1b6c28d4180c6304c3 (diff) | |
download | poky-59ab44fb3e4f5acba5000a1e27eef1b6cc1010b8.tar.gz |
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 master rev: 4c6f7a5d8bd6ada434b91037ecd5db06f3eac814)
(From OE-Core rev: 6f3dd6cfff781a7ab1c0495982da5c723e894ca9)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/ddimage')
-rwxr-xr-x | scripts/contrib/ddimage | 16 |
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" | |||
6 | # 1MB blocksize | 6 | # 1MB blocksize |
7 | BLOCKSIZE=1048576 | 7 | BLOCKSIZE=1048576 |
8 | 8 | ||
9 | function usage() { | 9 | usage() { |
10 | echo "Usage: $(basename $0) IMAGE DEVICE" | 10 | echo "Usage: $(basename $0) IMAGE DEVICE" |
11 | } | 11 | } |
12 | 12 | ||
13 | function image_details() { | 13 | image_details() { |
14 | IMG=$1 | 14 | IMG=$1 |
15 | echo "Image details" | 15 | echo "Image details" |
16 | echo "=============" | 16 | echo "=============" |
@@ -21,7 +21,7 @@ function image_details() { | |||
21 | echo "" | 21 | echo "" |
22 | } | 22 | } |
23 | 23 | ||
24 | function device_details() { | 24 | device_details() { |
25 | DEV=$1 | 25 | DEV=$1 |
26 | BLOCK_SIZE=512 | 26 | BLOCK_SIZE=512 |
27 | 27 | ||
@@ -61,10 +61,12 @@ if [ ! -e "$IMAGE" ]; then | |||
61 | fi | 61 | fi |
62 | 62 | ||
63 | 63 | ||
64 | if [ "${BLACKLIST_DEVICES/${DEVICE}/ERROR}" != "$BLACKLIST_DEVICES" ]; then | 64 | for i in ${BLACKLIST_DEVICES}; do |
65 | echo "ERROR: Device $DEVICE is blacklisted" | 65 | if [ "$i" = "$DEVICE" ]; then |
66 | exit 1 | 66 | echo "ERROR: Device $DEVICE is blacklisted" |
67 | fi | 67 | exit 1 |
68 | fi | ||
69 | done | ||
68 | 70 | ||
69 | if [ ! -w "$DEVICE" ]; then | 71 | if [ ! -w "$DEVICE" ]; then |
70 | echo "ERROR: Device $DEVICE does not exist or is not writable" | 72 | echo "ERROR: Device $DEVICE does not exist or is not writable" |