From 0d2c22d9825e91adc173e408a685159002188e0c Mon Sep 17 00:00:00 2001 From: chiteroman Date: Wed, 23 Oct 2024 14:22:27 +0200 Subject: [PATCH] Improve scripts --- module/customize.sh | 41 ++++++++++++++++++++++++++++++++++++----- module/post-fs-data.sh | 30 +++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/module/customize.sh b/module/customize.sh index 007aa85..c382d26 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -1,3 +1,12 @@ +# Don't flash in recovery! +if ! $BOOTMODE; then + ui_print "*********************************************************" + ui_print "! Install from recovery is NOT supported" + ui_print "! Recovery sucks" + ui_print "! Please install from Magisk / KernelSU / APatch app" + abort "*********************************************************" +fi + # Module requires Zygisk to work isZygiskEnabled=$(magisk --sqlite "SELECT value FROM settings WHERE key='zygisk';") if [ "$isZygiskEnabled" == "value=0" ] && [ ! -d "/data/adb/modules/zygisksu" ]; then @@ -15,10 +24,9 @@ if [ -d "/data/adb/modules/safetynet-fix" ]; then ui_print "! safetynet-fix module removed. Do NOT install it again along PIF" fi -# playcurl must be removed when flashing PIF +# playcurl warn if [ -d "/data/adb/modules/playcurl" ]; then - touch "/data/adb/modules/playcurl/remove" - ui_print "! playcurl module removed!" + ui_print "! playcurl may overwrite fingerprint with invalid one, be careful!" fi # MagiskHidePropsConf module is obsolete in Android 8+ but it shouldn't give issues @@ -28,6 +36,29 @@ fi # Check custom fingerprint if [ -f "/data/adb/pif.json" ]; then - mv -f "/data/adb/pif.json" "/data/adb/pif.json.old" - ui_print "- Backup custom pif.json" + ui_print "!!! WARNING !!!" + ui_print "- You are using custom pif.json (/data/adb/pif.json)" + ui_print "- Remove that file if you can't pass attestation test!" fi + +# Uninstall conflict apps +APPS=" +/system/app/EliteDevelopmentModule +/system/app/XInjectModule +/system/product/app/XiaomiEUInject +/system/product/app/XiaomiEUInject-Stub +/system/system_ext/app/hentaiLewdbSVTDummy +/system/system_ext/app/PifPrebuilt +" + +for APP in $APPS; do + if [ -d "$APP" ]; then + mkdir -p "${MODPATH}${APP}" + if [ "$KSU" = true ] || [ "$APATCH" = true ]; then + mknod "${MODPATH}${APP}" c 0 0 + else + touch "${MODPATH}${APP}/.replace" + fi + ui_print "- Removed: $(basename "$APP")" + fi +done diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 6f41620..49153e6 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -1,11 +1,35 @@ MODPATH="${0%/*}" -. $MODPATH/common_func.sh +. "$MODPATH"/common_func.sh # Remove Play Services from Magisk DenyList when set to Enforce in normal mode if magisk --denylist status; then magisk --denylist rm com.google.android.gms +else + # If DenyList is disabled, maybe you are using Shamiko + magisk --denylist add com.google.android.gms com.google.android.gms.unstable fi +# Uninstall conflict apps +APPS=" +/system/app/EliteDevelopmentModule +/system/app/XInjectModule +/system/product/app/XiaomiEUInject +/system/product/app/XiaomiEUInject-Stub +/system/system_ext/app/hentaiLewdbSVTDummy +/system/system_ext/app/PifPrebuilt +" + +for APP in $APPS; do + if [ -d "$APP" ]; then + mkdir -p "${MODPATH}${APP}" + if [ "$KSU" = true ] || [ "$APATCH" = true ]; then + mknod "${MODPATH}${APP}" c 0 0 + else + touch "${MODPATH}${APP}/.replace" + fi + fi +done + # Conditional early sensitive properties # Samsung @@ -22,12 +46,12 @@ resetprop_if_diff ro.is_ever_orange 0 # Microsoft for PROP in $(resetprop | grep -oE 'ro.*.build.tags'); do - resetprop_if_diff $PROP release-keys + resetprop_if_diff "$PROP" release-keys done # Other for PROP in $(resetprop | grep -oE 'ro.*.build.type'); do - resetprop_if_diff $PROP user + resetprop_if_diff "$PROP" user done resetprop_if_diff ro.adb.secure 1 resetprop_if_diff ro.debuggable 0