pmaports/device/testing/device-planet-geminipda/10-geminipda-loopback-device.sh
Oliver Smith 64035ac463
device/*: move to device/testing/* (!1063)
Prepare for better device categorization by moving everything to testing
subdir first.

[skip-ci]: chicken-egg problem: passing pmaports CI depends on pmbootstrap MR
				depends on this MR

Related: postmarketos#16
2020-03-14 08:35:32 +01:00

25 lines
500 B
Bash

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