I am trying to automate the creation of Raspberry Pi images under Docker virtual machine to run it in common CI systems like bitbucket-pipelines.
On physical system I am using "template" image, mount it't partitions to local directories, then populate it with script and unmount. To mount it I use script like following:
loopdevice=`losetup -f --show -P images/template.img`
echo $loopdevice > loopdevice
mkdir -p images/p1
mkdir -p images/p2
mkdir -p images/p3
mount ${loopdevice}p1 images/p1
mount ${loopdevice}p2 images/p2
mount ${loopdevice}p3 images/p3
(image contains 3 partitions, which are mounted to 3 directories).
Unfortunately, I can't use loopback devices inside Dcoker container if not priviledged and I can't make it priviledged inside Bitbucket pipelines. I see deadend here.
So, the question is: are there any Linux tools to manipulate filesystem image files without mounting them to loopback devices?