image_signing: simplify & fix mount cleanups

We don't need all this infrastructure for arbitrary cleanups when we
only ever run 2 clean up steps.  This also fixes a subtle bug in the
old logic: we registered cleanups in the logical order of (1) mounts
and then (2) loopbacks, but the cleanup loop walks the registered
calls in reverse order.  This means the loopback cleanup would fail
and timeout because we hadn't unmounted the partitions yet.  The
overall script doesn't fail as cleanup uses `set +e`, but it makes
every script waste ~10 seconds at exit.

BUG=None
TEST=running set_lsb_release.sh on images works quickly now
BRANCH=None

Change-Id: Ibd25ad6ba149c64e08ac3ab860342fe7b2cc7851
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2923825
Reviewed-by: George Engelbrecht <engeg@google.com>
1 file changed