Refactor fixSPL to prevent early exit

This commit is contained in:
Pierre-Hugues Husson 2018-05-14 13:34:52 +02:00
parent 903725538c
commit 11cbdea0e9

View File

@ -2,17 +2,10 @@
set -e set -e
if mount -o remount,rw /system;then fixSPL() {
resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1) img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)"
elif mount -o remount,rw /;then [ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)"
resize2fs /dev/root if [ -n "$img" ];then
fi
mount -o remount,ro /system
mount -o remount,ro /
img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)"
[ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)"
if [ -n "$img" ];then
#Rewrite SPL/Android version if needed #Rewrite SPL/Android version if needed
Arelease="$(getSPL $img android)" Arelease="$(getSPL $img android)"
setprop ro.keymaster.xxx.release $Arelease setprop ro.keymaster.xxx.release $Arelease
@ -20,7 +13,7 @@ if [ -n "$img" ];then
#Only Android 8.0 needs this #Only Android 8.0 needs this
if ! echo "$Arelease" |grep -qF 8.0;then if ! echo "$Arelease" |grep -qF 8.0;then
exit 0 return 0
fi fi
for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so;do for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so;do
@ -39,8 +32,21 @@ if [ -n "$img" ];then
mount -o bind /dev/phh/$b $f mount -o bind /dev/phh/$b $f
done done
setprop ctl.restart keymaster-3-0 setprop ctl.restart keymaster-3-0
fi
}
if mount -o remount,rw /system;then
resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1)
elif mount -o remount,rw /;then
resize2fs /dev/root
fi fi
mount -o remount,ro /system
mount -o remount,ro /
fixSPL
if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml;then if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml;then
mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl
fi fi