change ro.boot.vbmeta.digest logic

migrate from system.prop to reset prop due system.prop not working on some device
This commit is contained in:
KOWX712
2024-10-28 19:50:02 +08:00
parent 608f3364af
commit 4a7437705c
4 changed files with 24 additions and 7 deletions

6
module/common/boot_hash Normal file
View File

@@ -0,0 +1,6 @@
# This file is to pass Minotaur native test 'Partition Check Fail'
# Download Key Attestation (chiteroman fork recommended)
# Link: https://github.com/chiteroman/KeyAttestation/releases
# Get your VerifiedBootHash value from Key Attestation app
# Ask here if you don't know how to do: https://t.me/kowchannelchat
# Paste verifiedBootHash value on next line and save

View File

@@ -1,3 +0,0 @@
# To pass Minotaur native test Conventional Test (8), you can get your VerifiedBootHash from KeyAttestation app
# Put verifiedBootHash after 'ro.boot.vbmeta.digest=' and remove the '#' infront of it.
#ro.boot.vbmeta.digest=

View File

@@ -100,11 +100,20 @@ elif [ -d "$CONFIG_DIR" ]; then
fi
fi
if [ ! -f "/data/adb/modules/$MODNAME/system.prop" ]; then
mv "$COMPATH/system.prop" "$MODPATH/system.prop"
ORG_DIR="/data/adb/modules/$MODNAME"
if [ ! -f "$ORG_DIR/boot_hash" ]; then
mv "$COMPATH/boot_hash" "$MODPATH/boot_hash"
else
rm -f "$COMPATH/system.prop"
mv "/data/adb/modules/$MODNAME/system.prop" "$MODPATH/system.prop"
rm -f "$COMPATH/boot_hash"
mv "$ORG_DIR/boot_hash" "$MODPATH/boot_hash"
fi
# Migrate from old version setup
if [ -f "$ORG_DIR/system.prop" ]; then
hash_value=$(sed -n 's/^ro.boot.vbmeta.digest=//p' "$ORG_DIR/system.prop")
if [ -n "$hash_value" ]; then
echo -e "\n$hash_value" >> "$MODPATH/boot_hash"
fi
fi
kb="$COMPATH/.keybox"

View File

@@ -2,6 +2,11 @@ MODDIR=${0%/*}
COMPATH="$MODDIR/common"
TS="/data/adb/modules/tricky_store"
hash_value=$(grep -v '^#' "$MODDIR/boot_hash" | tr -d '[:space:]')
if [ -n "$hash_value" ]; then
resetprop -n ro.boot.vbmeta.digest "$hash_value"
fi
if [ ! -f "$COMPATH/ninstalled" ] || [ ! -f "$COMPATH/disabled" ] || [ ! -f "$COMPATH/normal" ]; then
sed -i 's/^description=.*/description=Module is corrupted, please reinstall module./' "$MODDIR/module.prop"
exit 1