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>
# 1MB blocksize
BLOCKSIZE=1048576
-function usage() {
+usage() {
echo "Usage: $(basename $0) IMAGE DEVICE"
}
-function image_details() {
+image_details() {
IMG=$1
echo "Image details"
echo "============="
echo ""
}
-function device_details() {
+device_details() {
DEV=$1
BLOCK_SIZE=512
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"