diff options
| author | Tom Dewey <146750643+tdewey-rpi@users.noreply.github.com> | 2024-05-15 15:50:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-15 15:50:40 +0100 |
| commit | fb48183f0d49df3d069f0086263d829efa899c70 (patch) | |
| tree | f590a578a04985b4035bf7dc02a1f63519fc8b84 /build.sh | |
| parent | d790fed832188d41c1fb5d8506d833d053e4a81c (diff) | |
Expand trap cleanup function (#773)
* build.sh: Unmount intermediates on trap
Iterate through image files which might be in use and detach them
Avoid silent failures - let the user know whether the build failed
* common: update unmount_image
Use udevadm settle instead of sleep if possible
Use losetup's -j option to find the loop device associated with a give image file
* build.sh: update clean-up trap term
---------
Co-authored-by: Serge Schneider <serge@raspberrypi.com>
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -158,7 +158,17 @@ do done term() { - true; #TODO: Cleanup + if [ "$?" -ne 0 ]; then + log "Build failed" + else + log "Build finished" + fi + unmount "${STAGE_WORK_DIR}" + if [ "$STAGE" = "export-image" ]; then + for img in "${STAGE_WORK_DIR}/"*.img; do + unmount_image "$img" + done + fi } trap term EXIT INT TERM |
