pmaports/device/testing/device-planet-geminipda/10-geminipda-loopback-device.sh
2023-04-26 18:13:53 +02:00

25 lines
500 B
Bash

#!/bin/sh
. ./init_functions.sh
source_deviceinfo
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