refactor: patcher(mbcpapp.sh): move to new install patched app behavior

no longer requires specific app version

with [Install & delete local detection model & open app] option, it will check for su binary and warn if it's not found

also checks the commit id of repacked APK and warn before installing if it's mismatch

Signed-off-by: Cuynu <cuynu@proton.me>
This commit is contained in:
Cuynu 2026-07-21 16:25:09 +07:00
commit 00be518085
Signed by: cuynu
GPG key ID: 1F01341D0B42B51A

View file

@ -329,7 +329,7 @@ echo "Original APK must be inside [mbapk] folder !"
echo -------------------------------------------------------------
echo "Current commit : $COMMIT ($BRANCH)"
echo "Source code : https://git.disroot.org/mbcp/mbbpatch.git"
echo "Documentation : see [docs] folder"
echo "Documentation : see [README.md] or [docs] folder"
echo "Written from scratch by Cuynu with love <3"
echo -------------------------------------------------------------
echo App status : $(successunpack)
@ -455,31 +455,34 @@ done
info "Cleared !"
;;
'Install patched app' )
info 'Select your patched version to continue'
PS3='Select patched version to continue, or [4] to quit : '
select opt in 'App patched with newer version [v6.4.59+]' 'App patched with specific version' 'App patched with older version [v6.4.55 or lower]' 'Exit'
echo 'Choose install options :'
ls mbcpapp_apk | grep -q MBCP_Flutter_SelfPatched_$(git rev-parse --short HEAD).apk || err "Couldn't find APK with current commit ID, you might already do new commits : $(git rev-parse --short HEAD)" || warn "Please repack APK again after each new commits !"
PS3='Select option to continue, or [3] to quit : '
select opt in 'Install & open app' 'Install & delete local detection model & open app' 'Exit'
do
if [ "$opt" == 'App patched with newer version [v6.4.59+]' ]; then
if [ "$opt" == 'Install & open app' ]; then
if [ -f "$DIRPATH"/mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk ]
then
warn "MBCP Helper / CorePatch must be installed with disable digest verify on !!!"
warn "You must have connected Android device with USB debugging turned on in order to install !!!"
adb kill-server
adb start-server
adb install "mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk" | grep -q Success && echo "Opening app..." && adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity || echo "Failed to install app, please check your device!"
adb install "mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk" | grep -q Success && echo "App installation successful! Opening app..." && adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity || echo "Failed to install app, please check your device!"
else
err "[MBCP_Flutter_SelfPatched_$COMMIT.apk] not found, cannot continue !"
fi
elif [ "$opt" == 'App patched with specific version' ]; then
elif [ "$opt" == 'Install & delete local detection model & open app' ]; then
warn "This method only works with v6.4.58 ~ v6.5.6 !"
if [ -f "$DIRPATH"/mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk ]
then
warn "MBCP Helper / CorePatch must be installed with disable digest verify on !!!"
warn "You must have connected Android device with USB debugging turned on in order to install !!!"
adb kill-server
adb start-server
adb install "mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk" | grep -q Success && echo "Opening app..." && adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity || echo "Failed to install app, please check your device!"
adb shell [ -f /system/bin/su ] || warn "No su binary found in [/system/bin/su] from connected device. Root-related commands will not work!!"
adb install "mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk" | grep -q Success && echo "App installation successful! Opening app..." && adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity || echo "Failed to install app, please check your device!"
# Delete zimperium detection files
adb shell su -c rm -rf /data/data/com.mbmobile/files/0*
adb shell su -c rm -rf /data/data/com.mbmobile/files/1*
@ -505,21 +508,7 @@ do
else
err "[MBCP_Flutter_SelfPatched_$COMMIT.apk] not found, cannot continue !"
fi
elif [ "$opt" == 'App patched with older version [v6.4.55 or lower]' ]; then
if [ -f "$DIRPATH"/mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk ]
then
warn "MBCP Helper / CorePatch must be installed with disable digest verify on !!!"
warn "You must have connected Android device with USB debugging turned on in order to install !!!"
adb kill-server
adb start-server
adb install "mbcpapp_apk/MBCP_Flutter_SelfPatched_$COMMIT.apk" | grep -q Success && echo "Opening app..." && adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity || echo "Failed to install app, please check your device!"
adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity
else
err "[MBCP_Flutter_SelfPatched_$COMMIT.apk] not found, cannot continue !"
fi
elif [ "$opt" == 'Exit' ]; then
PS3='Please select options to continue : '
break