diff --git a/MBCPApp/mbcpapp.sh b/MBCPApp/mbcpapp.sh index d2ce998..014985b 100755 --- a/MBCPApp/mbcpapp.sh +++ b/MBCPApp/mbcpapp.sh @@ -87,7 +87,7 @@ echo ------------------------------------------------------------- # Main functions PS3='Please select options to continue : ' -select opt in 'Pull latest commit' 'Unpack APK' 'Convert apks to apk' 'Repack APK' 'Install patched app' 'MBShield Check' 'Patch App' 'Extract assets [ROOT]' 'Launch MBCPApp/MBBank' 'Force close MBCPApp/MBBank' 'Clear MBCPApp/MBBank app data' 'Clean patched app' 'Download tools' 'Install platform-tools' 'Exit' +select opt in 'Pull latest commit' 'Unpack APK' 'Convert apks to apk' 'Repack APK' 'Install patched app' 'MBShield Check' 'Patch App' 'Extract assets [ROOT]' 'Launch MBCPApp/MBBank' 'Force close MBCPApp/MBBank' 'Clear MBCPApp/MBBank app data' 'Clean patched app' 'Download tools' 'Exit' do if [ "$opt" == 'Download tools' ]; then cd tools && rm -rf *.jar @@ -294,16 +294,6 @@ done adb shell am start -n com.mbmobile/io.flutter.plugins.MainActivity echo "INFO : Current logged in account will remain present, even if app data is cleared !" - - elif [ "$opt" == 'Install platform-tools' ]; then - echo --------------------------------------- - echo Requesting sudo permisson... - echo --------------------------------------- - #Kill adb process if present - killall adb - killall fastboot - sudo ./platformtools.sh - elif [ "$opt" == 'Pull latest commit' ]; then git pull origin mbflutter echo "Please run patcher again !" diff --git a/MBCPApp/platformtools.sh b/MBCPApp/platformtools.sh deleted file mode 100755 index 86f45a9..0000000 --- a/MBCPApp/platformtools.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -# Check for macOS env - -if [[ $OSTYPE == 'darwin'* ]]; then - echo "Install platform-tools only working with Linux only." - echo "Since you are running on macOS environment, please install [android-platform-tools] with brew !" - exit -fi - -# Global install location -INSTALL_BIN_DIR="/usr/local/bin" -PLATFORM_TOOLS_URL="https://dl.google.com/android/repository/platform-tools-latest-linux.zip" -TEMP_DIR="/tmp/platform-tools-temp" - -# --- Check 1: Root privileges --- -if [ "$(id -u)" -ne 0 ]; then - echo "Error: This script needs to be run with root privileges." - echo "Please run using: sudo $0" - exit 1 -fi - -# --- Check 2: Check if adb and fastboot already exist globally --- -# Check specifically in the target directory or rely on PATH which should include it -if command -v adb &> /dev/null && command -v fastboot &> /dev/null; then - echo "adb and fastboot seem to be already installed and accessible in PATH." - echo "Location:" - command -v adb - command -v fastboot - echo "Versions:" - adb --version - fastboot --version - read -p "Do you want to attempt to re-install/update anyway? (y/N): " confirm - if [[ ! "$confirm" =~ ^[Yy]$ ]]; then - echo "Exiting." - exit 0 - fi - echo "Proceeding with re-installation..." -fi - -echo "adb or fastboot potentially missing or user requested re-install." -echo "Attempting to download and install globally to $INSTALL_BIN_DIR..." - -# --- Check 3: Dependencies --- -if ! command -v wget &> /dev/null; then - echo "Error: wget is required but not found." - echo "Please install it (e.g., sudo apt update && sudo apt install wget)" - exit 1 -fi - -if ! command -v unzip &> /dev/null; then - echo "Error: unzip is required but not found." - echo "Please install it (e.g., sudo apt update && sudo apt install unzip)" - exit 1 -fi - -# --- Download --- -echo "Downloading platform-tools..." -# Clean previous temp files if they exist -rm -f /tmp/platform-tools.zip -rm -rf "$TEMP_DIR" - -wget -O /tmp/platform-tools.zip "$PLATFORM_TOOLS_URL" -q --show-progress -if [ $? -ne 0 ]; then - echo "Error: Failed to download platform-tools." - exit 1 -fi - -# --- Extract --- -echo "Extracting platform-tools to temporary location..." -mkdir -p "$TEMP_DIR" -unzip -o /tmp/platform-tools.zip -d "$TEMP_DIR" > /dev/null # Suppress unzip output -if [ $? -ne 0 ]; then - echo "Error: Failed to extract platform-tools." - rm -f /tmp/platform-tools.zip - rm -rf "$TEMP_DIR" - exit 1 -fi - -# --- Install Binaries --- -echo "Moving adb and fastboot to $INSTALL_BIN_DIR..." -# Move only the essential binaries. Add others if needed (e.g., mke2fs, systrace/) -# Use 'cp' instead of 'mv' if you want to keep the temp dir for inspection -cp "$TEMP_DIR/platform-tools/adb" "$INSTALL_BIN_DIR/" -if [ $? -ne 0 ]; then - echo "Error: Failed to copy adb to $INSTALL_BIN_DIR." - # Attempt cleanup before exiting - rm -f /tmp/platform-tools.zip - rm -rf "$TEMP_DIR" - exit 1 -fi - -cp "$TEMP_DIR/platform-tools/fastboot" "$INSTALL_BIN_DIR/" -if [ $? -ne 0 ]; then - echo "Error: Failed to copy fastboot to $INSTALL_BIN_DIR." - # Attempt cleanup before exiting - rm -f /tmp/platform-tools.zip - rm -rf "$TEMP_DIR" - exit 1 -fi - -# Ensure they are executable by all users -chmod +x "$INSTALL_BIN_DIR/adb" -chmod +x "$INSTALL_BIN_DIR/fastboot" - -# --- Cleanup --- -echo "Cleaning up temporary files..." -rm -f /tmp/platform-tools.zip -rm -rf "$TEMP_DIR" - -echo "--------------------------------------------------" -echo "adb and fastboot have been installed globally to:" -echo "$INSTALL_BIN_DIR" -echo "--------------------------------------------------" -echo "You should now be able to run 'adb' and 'fastboot' from any location." -echo "Verifying installation:" -adb --version -fastboot --version -echo "--------------------------------------------------" - -exit 0 \ No newline at end of file