Pierre-Hugues Husson | f181109 | 2018-04-10 18:33:33 +0200 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
Pierre-Hugues Husson | 16ea168 | 2018-04-15 19:19:47 +0200 | [diff] [blame] | 5 | if mount -o remount,rw /system;then |
| 6 | resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1) |
| 7 | elif mount -o remount,rw /;then |
| 8 | resize2fs /dev/root |
| 9 | fi |
Pierre-Hugues Husson | f181109 | 2018-04-10 18:33:33 +0200 | [diff] [blame] | 10 | mount -o remount,ro /system |
Pierre-Hugues Husson | 16ea168 | 2018-04-15 19:19:47 +0200 | [diff] [blame] | 11 | mount -o remount,ro / |
Pierre-Hugues Husson | 520fea1 | 2018-04-24 22:36:59 +0200 | [diff] [blame^] | 12 | |
| 13 | img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)" |
| 14 | [ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)" |
| 15 | [ -z "$img" ] && exit 0 |
| 16 | |
| 17 | #Rewrite SPL/Android version if needed |
| 18 | Arelease="$(getSPL $img android)" |
| 19 | setprop ro.keymaster.xxx.release $Arelease |
| 20 | setprop ro.keymaster.xxx.security_patch "$(getSPL $img spl)" |
| 21 | |
| 22 | #Only Android 8.0 needs this |
| 23 | if ! echo "$Arelease" |grep -qF 8.0;then |
| 24 | exit 0 |
| 25 | fi |
| 26 | |
| 27 | for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so;do |
| 28 | [ ! -f $f ] && continue |
| 29 | b="$(basename "$f")" |
| 30 | |
| 31 | mkdir -p /dev/phh/ |
| 32 | cp $f /dev/phh/$b |
| 33 | sed -i -e 's/ro.build.version.release/ro.keymaster.xxx.release/g' -e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' /dev/phh/$b |
| 34 | if echo $f |grep vendor;then |
| 35 | chcon u:object_r:vendor_file:s0 /dev/phh/$b |
| 36 | else |
| 37 | chcon u:object_r:system_file:s0 /dev/phh/$b |
| 38 | fi |
| 39 | chmod 0644 /dev/phh/$b |
| 40 | mount -o bind /dev/phh/$b $f |
| 41 | done |
| 42 | setprop ctl.restart keymaster-3-0 |