diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2017-09-13 23:40:01 +0200 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2017-09-13 23:40:01 +0200 |
commit | c7ac1123a3d0c733921a50b7652c4791a40edb7e (patch) | |
tree | d53f15ff57662c1349327fce3a11b7f879099d39 | |
parent | 8ef3754584430c8b72f3e342f4d238cc50450e7a (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-x | mksdcard | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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 |