From: mauronofrio Date: Mon, 22 Jul 2019 11:18:17 +0000 (+0200) Subject: Add a script to properly flash Hydrogen OS reserve.img X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6a832eae58d9e61dd0761b1b8dbff5718e3af485;p=GitHub%2Fmoto-9609%2Ftwrp_device_motorola_troika.git Add a script to properly flash Hydrogen OS reserve.img --- diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index fd81196..89d15cc 100644 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -37,11 +37,6 @@ on fs symlink /dev/block/bootdevice/by-name/mdm_oem_stanvbk /dev/block/bootdevice/by-name/mdm_oem_stanvbk_a symlink /dev/block/bootdevice/by-name/mdm_oem_stanvbk /dev/block/bootdevice/by-name/mdm_oem_stanvbk_b - # this is not good way for Hydrogen payload reserve - write /dev/block/bootdevice/by-name/reserve 0 - symlink /dev/block/bootdevice/by-name/reserve /dev/block/bootdevice/by-name/reserve_a - symlink /dev/block/bootdevice/by-name/reserve /dev/block/bootdevice/by-name/reserve_b - chmod 0660 /dev/qseecom chown system drmrpc /dev/qseecom chmod 0664 /dev/ion @@ -122,6 +117,13 @@ service time_daemon /sbin/time_daemon disabled seclabel u:r:recovery:s0 +service patchreserve /sbin/patchreserve.sh + user root + group root + disabled + oneshot + seclabel u:r:recovery:s0 + # This helps fix ld.config.txt errors from the linker on Android 8.1+ service ldconfigtxt /sbin/touch /sbin/ld.config.txt oneshot @@ -155,6 +157,10 @@ on property:vendor.sys.listeners.registered=true start gatekeeper-1-0 start servicemanager restart time_daemon + start patchreserve on property:sys.usb.config=mtp,adb restart time_daemon + +on property:twrp.mount_to_decrypt=1 + start patchreserve diff --git a/recovery/root/sbin/patchreserve.sh b/recovery/root/sbin/patchreserve.sh new file mode 100755 index 0000000..79f77bb --- /dev/null +++ b/recovery/root/sbin/patchreserve.sh @@ -0,0 +1,46 @@ +#!/sbin/sh +# This script is needed for Hydrogen OS to place reserve.img in the right place. + + +# Check if already exist the /data/reserve directory symlink and create it +if [ -d /data/reserve ]; +then + echo "/data/reserve already exist" +else + mkdir /data/reserve + echo "/data/reserve created" +fi + +# Check if already exist the /data/reserve/reserve.img symlink and create it +if [ -f /data/reserve/reserve.img ]; +then + echo "/data/reserve/reserve.img already exist" +else + touch /data/reserve/reserve.img + echo "/data/reserve/reserve.img created" +fi + +# Check if already exist the /dev/block/bootdevice/by-name/reserve_a symlink and delete it +if [ -L /dev/block/bootdevice/by-name/reserve_a ]; +then + rm -f /dev/block/bootdevice/by-name/reserve_a + echo "symlink_a exist and removed" +else + echo "symlink_a doesn't exist" +fi + +# Check if already exist the /dev/block/bootdevice/by-name/reserve_b symlink and delete it +if [ -L /dev/block/bootdevice/by-name/reserve_b ]; +then + rm -f /dev/block/bootdevice/by-name/reserve_b + echo "symlink_b exist and removed" +else + echo "symlink_b doesn't exist" +fi + +# Creating symlinks /dev/block/bootdevice/by-name/reserve_a and /dev/block/bootdevice/by-name/reserve_b +ln -s /data/reserve/reserve.img /dev/block/bootdevice/by-name/reserve_a +ln -s /data/reserve/reserve.img /dev/block/bootdevice/by-name/reserve_b + +echo "Patch Reserve script complete." +exit 0