summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-09-13 23:40:01 +0200
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-09-13 23:40:01 +0200
commitc7ac1123a3d0c733921a50b7652c4791a40edb7e (patch)
treed53f15ff57662c1349327fce3a11b7f879099d39
parent8ef3754584430c8b72f3e342f4d238cc50450e7a (diff)
mksdcard: add support for optional file
When the file name to write starts with a '-', we now print a warning, but we don't fail image creation, instead we create the partition, but don't write any content into it. Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rwxr-xr-xmksdcard17
1 files changed, 15 insertions, 2 deletions
diff --git a/mksdcard b/mksdcard
index 440ee6f..ac64777 100755
--- a/mksdcard
+++ b/mksdcard
@@ -143,6 +143,14 @@ while IFS=, read name size align type format file; do
full_path_file=
if [ -z "$size" ] ; then continue; fi
size=$(real_size_in_kb $size)
+
+ # if $file start with '-', don't fail if missing
+ optionalfile=0
+ if [ "${file#-}"x != "${file}x" ] ; then
+ optionalfile=1
+ file=${file#-}
+ fi
+
echo "=== Entry: name: $name, size: $size, align: $align, type: $type, format: $format, file: $file"
# align partition start
@@ -170,8 +178,13 @@ while IFS=, read name size align type format file; do
done
if [ -z "$full_path_file" ]; then
- echo "Unable to find file $file in $INC"
- exit 1
+ if [ "$optionalfile" = 0 ]; then
+ echo "Error: Unable to find file $file in $INC"
+ exit 1
+ else
+ echo "Warning: Unable to find file $file in $INC"
+ full_path_file=
+ fi
fi
fi