jjb/common: run-test-rsync: fix empty variables 45/10245/1
authorKevin Hilman <khilman@baylibre.com>
Wed, 19 Jul 2017 00:20:07 +0000 (00:20 +0000)
committerKevin Hilman <khilman@baylibre.com>
Wed, 19 Jul 2017 00:20:09 +0000 (00:20 +0000)
Some variables are allowed to exist, but be empty (e.g. $DEVICE_DTB
for QEMU builds.)  If the variable is empty, do not attempt to copy.

Change-Id: I89850402a225766496e5c2b5b9a45ffa6ec11815
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
jjb/common/include-agl-run-test-rsync-changeid.sh

index 6416555..be3f68b 100644 (file)
@@ -25,9 +25,12 @@ cd output
 pwd
 ls -alhR tmp/deploy/images
 
-# copy files to $DEST
+# copy files to $DEST (only if variable is non-empty)
 for i in DEVICE_DTB DEVICE_KERNEL DEVICE_INITRAMFS DEVICE_NBDROOT; do
-    eval cp -avL tmp/deploy/images/${TARGETMACHINE}/$(echo "$"${i}) ${DEST}/
+    FILE=$(eval echo \$${i})
+    if [ -n "$FILE" ]; then
+      cp -avL tmp/deploy/images/${TARGETMACHINE}/${FILE} ${DEST}/
+    fi
 done
 
 tree $DEST