From 4a7437705cfeecfdcaa39e19455488966840fc23 Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Mon, 28 Oct 2024 19:50:02 +0800 Subject: [PATCH] change ro.boot.vbmeta.digest logic migrate from system.prop to reset prop due system.prop not working on some device --- module/common/boot_hash | 6 ++++++ module/common/system.prop | 3 --- module/customize.sh | 17 +++++++++++++---- module/service.sh | 5 +++++ 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 module/common/boot_hash delete mode 100644 module/common/system.prop diff --git a/module/common/boot_hash b/module/common/boot_hash new file mode 100644 index 0000000..959c99e --- /dev/null +++ b/module/common/boot_hash @@ -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 \ No newline at end of file diff --git a/module/common/system.prop b/module/common/system.prop deleted file mode 100644 index f5a92ad..0000000 --- a/module/common/system.prop +++ /dev/null @@ -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= \ No newline at end of file diff --git a/module/customize.sh b/module/customize.sh index 9b6b290..7c28449 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -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" diff --git a/module/service.sh b/module/service.sh index a9506f0..595d60f 100644 --- a/module/service.sh +++ b/module/service.sh @@ -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