merge_factory_usbimg.sh: improvement for low disk space under /tmp
Previously, make_image_resource.sh will generate a file under /tmp and
use it to format the output image. In merge_factory_usbimg.sh, it also
invokes make_image_resource.sh to generate a resource imgae under /tmp.
This will have error when there is not enough space left under /tmp.
This CL mitigates this by mounting the output image under a loop device,
then format the loop device, which consumes less space under /tmp.
When merging usb images, some intermediary files will be put under
/tmp. It now shows error message for users to specify $TMPDIR to another
path when the merged usb image cannot be generated, which is likely not
enough space left under /tmp.
It also removes --tmpdir option when using command 'mktemp' because it
will try $TMPDIR and then /tmp by default.
TEST=./merge_factory_usbimg.sh -f output.bin usbimg1.bin usbimg2.bin
a. Check it will throw error message when there is not enough
space under /tmp to generate the merged usb image.
b. Check it consumes less space under /tmp compared to original
Tested-by: Bowgo Tsai <email@example.com>
Reviewed-by: Hung-Te Lin <firstname.lastname@example.org>
Commit-Queue: Bowgo Tsai <email@example.com>
2 files changed