mount_gpt_image.sh: fix unmounting when --from is not used

When the image is omitted, FLAGS_from is empty, but we still try to
construct paths based on it and then use them (including passing to
losetup tools).  We don't actually use those results when the file
is omitted which is why we unmount fine.  We also disable `set -e`
in the unmount path so we can unmount as much as possible even if
there are some errors which is why we don't see hard failures.  We
can improve that logic in a followup.

BUG=chromium:955147
TEST=running mount & unmount no longer shows losetup errors
	./mount_gpt_image.sh --from=../build/images/betty/latest/ --image=chromiumos_qemu_image.bin --safe
	./mount_gpt_image.sh --unmount

Change-Id: Ide995ac8943334371690b85364b9c8de0d4a997c
Reviewed-on: https://chromium-review.googlesource.com/1700156
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
1 file changed