pmaports/device/testing/device-motorola-maserati/10-safestrap-maserati.sh
2023-04-26 18:13:52 +02:00

30 lines
706 B
Bash

#!/bin/sh
. ./init_functions.sh
source_deviceinfo
mount_safestrap() {
grep -q PMOS_NO_SAFESTRAP /proc/cmdline && return
mkdir /ss
mount -t vfat -o uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020 ${deviceinfo_safestrap_partition} /ss
slot_loc=$(cat /ss/safestrap/active_slot)
if [ ! -z $slot_loc ]; then
if [ "$slot_loc" = "stock" ]; then
umount /ss
elif [ "$slot_loc" = "safe" ]; then
umount /ss
else
# setup loopbacks
data_partition=$(losetup -f)
losetup $data_partition /ss/safestrap/$slot_loc/userdata.img
kpartx -afs $data_partition
system_partition=$(losetup -f)
losetup $system_partition /ss/safestrap/$slot_loc/system.img
fi
fi
}
mount_safestrap