contrib: Fix early cleanup in recovery script

Currently, `` tries to clean up
intermediate files using `trap "rm ${file}" RETURN` to delete the files
when the function returns.  This does not work correctly because
`` calls `shopt -s extdebug` which causes the `RETURN` trap to
be inherited by called functons.  Thus the first function invoked causes
the file to be removed on return.

Add a `cleanup_files` array whose members get deleted (if they exist) by
the `cleanup` function called by the `EXIT` trap.  This is not quite as
"clean" as using `RETURN`, but it works.

TEST=ran the script to verify the temp file was cleaned up

Change-Id: I8ca9d3aeb3a132abe8492968d8f510535992f49c
Tested-by: Ian Flanigan <>
Auto-Submit: Ian Flanigan <>
Commit-Queue: Amin Hassani <>
Reviewed-by: Amin Hassani <>
1 file changed