2019-01-19 00:03:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
. ./init_functions.sh
|
2023-05-30 06:53:50 +00:00
|
|
|
. /usr/share/misc/source_deviceinfo
|
2019-01-19 00:03:37 +00:00
|
|
|
|
|
|
|
mount_loopback_device() {
|
|
|
|
loopback_img=postmarketOS.img
|
|
|
|
partitions="/dev/mmcblk0p29 /dev/mmcblk0p30 /dev/mmcblk0p31"
|
|
|
|
|
|
|
|
mkdir /tmpmnt
|
|
|
|
for part in $partitions; do
|
|
|
|
mount -o ro $part /tmpmnt
|
|
|
|
|
|
|
|
if [ -f "/tmpmnt/$loopback_img" ]; then
|
|
|
|
mount -o remount,rw /tmpmnt
|
|
|
|
loopback_device=$(losetup -f)
|
|
|
|
losetup $loopback_device "/tmpmnt/$loopback_img"
|
|
|
|
kpartx -afs $loopback_device
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
umount /tmpmnt
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
mount_loopback_device
|