RPi-Distro / pi-gen

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

use a single partitioned loop device #641

Closed rfc6919 closed 1 year ago

rfc6919 commented 1 year ago

per https://github.com/RPi-Distro/pi-gen/issues/639, use a single partitioned loop device rather than multiple devices with offset/length.

testing is limited to "works for me, and doesn't leave any new errors in the output of build.sh". is there an actual test suite or anything like that?

XECDesign commented 1 year ago

I've merged this into the internal nightly build system. If it doesn't cause any issues, I'll merge the PR in a few days.

Thanks!

XECDesign commented 1 year ago

Pushed a couple of fixes.

unmount_image returns false and halts the whole build if the image isn't mounted in the first place. Adding the if statement back rather than using && should fix that.

Then if the loopback device is attached but the either partition is not mounted, you get umount: /dev/loopXpN: not mounted. and again, false is returned.

If the mounted partitions have subdirectories mounted, then umount isn't enough. Maybe an a recursive umount would be fine, but there's already an unmount option which should do the right thing.

I've also changed it to iterate over all the partitions rather than assuming there are only two.

XECDesign commented 1 year ago

Seems to work now, thanks.