mkfs: avoid blockdev failing to re-read partition table
Invoking `blockdev --rereadpt` straight after creating the file system
might fail with:
| blockdev: ioctl error on BLKRRPART: Device or resource busy
| Unexpected non-zero exit code 1 in /sbin/grml-debootstrap /sbin/grml-debootstrap /sbin/grml-debootstrap at line 1376 2132 0 detected!
| last bash command: blockdev --rereadpt "$main_device"
This is caused by udev kicking in and causing a race condition. Let's
invoke udevadm settle (which watches the udev event queue, and exits if
all current events are handled), and then retry `blockdev --rereadpt
...` up to 30 times/seconds.
Thanks: Darshaka Pathirana for bug report and initial investigation, and Chris Hofstaedtler for feedback
Closes: https://github.com/grml/grml-debootstrap/issues/273