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.

TEST=running on images works quickly now

Change-Id: Ibd25ad6ba149c64e08ac3ab860342fe7b2cc7851
Signed-off-by: Mike Frysinger <>
Reviewed-by: George Engelbrecht <>
1 file changed