pmaports/device/device-motorola-maserati/10-safestrap-maserati.sh
NotKit 12ebd049ff Motorola Droid 4 (maserati) (#1039)
Note about PMOS_NO_SAFESTRAP kernel cmdline:
This can be used to forcefully skip SafeStrap partition mount in device
initramfs hook, for example when booting with droid4-kexecboot on device with
SafeStrap configured as well.
2018-03-16 20:26:20 +00:00

30 lines
706 B
Bash

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