burtyb/clusterhat-image

losetup vs kpartx

larsks opened this issue · 0 comments

Just a comment on these lines...

Instead of using losetup followed by kpartx, you can just tell losetup to create devices for each partition using the -P (--partscan) flag. That is, if you do this:

$ sudo losetup -fP --show 2018-06-27-raspbian-stretch-lite.img
/dev/loop0

You get the following devices:

$ ls /dev/loop0*
/dev/loop0  /dev/loop0p1  /dev/loop0p2

So your code becomes a little simpler:

LOOP=`losetup -fP --show $DEST/ClusterHAT-$VER-lite-$REV-controller.img`
mount ${LOOP}p2 $MNT
mount ${LOOP}p1 $MNT/boot