RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.59k stars 1.62k forks source link

Compare mount output using base of dirname #771

Closed pevsonic closed 4 months ago

pevsonic commented 5 months ago

If you're building from a bind-mounted directory, the build will fail as it will find two entries to unmount, but a single unmount will remove them both causing an error. Adding a space means that the mountpoint will only match with a single mount entry ; the expected path, rather than the pre bind-mount.

Fixes issue #770

XECDesign commented 4 months ago

Many thanks! I've reproduced the issue you were seeing and this fixes it for me. I've made some additional changes to the PR while I was in the area. Could you please give this version a go and see if it still works for you as expected?

Normally changes go to the master branch and are then merged into arm64, so I've changed the base of the PR. You might need to merge it back into your arm64-based branch to test it.

Quite often people will try to rm -rf the work directory while there are some mountpoints there, which can cause all kinds of issues on the system, so I've added a warning not to do that.

Combined the previous implementation of unmount into a single while loop.

Added 5 retries so that if something goes wrong, it's not stuck in a loop trying to unmount forever.