From 45bfba2c0b86edf0e941b2b1231d7988780bc7d5 Mon Sep 17 00:00:00 2001 From: jefino9488 Date: Fri, 25 Oct 2024 00:49:59 +0530 Subject: [PATCH] drop quick_install.bat, made universal & remove unwanted --- installer.bat | 217 ++++++---------------------------------------- quick_install.bat | 147 ------------------------------- 2 files changed, 26 insertions(+), 338 deletions(-) delete mode 100644 quick_install.bat diff --git a/installer.bat b/installer.bat index 605d828..11aae03 100644 --- a/installer.bat +++ b/installer.bat @@ -21,43 +21,26 @@ if "%device%" equ "unknown" ( timeout /t 5 >nul goto wait_for_device ) -if "%device%" neq "xaga" if "%device%" neq "xagapro" if "%device%" neq "xagain" ( - echo Compatible devices: xaga, xagapro, xagain + +set "compatibleDevice=false" +for /f "delims=" %%i in (%SCRIPT_PATH%\compactable_list.txt) do ( + if "%device%" equ "%%i" set "compatibleDevice=true" +) + +if "%compatibleDevice%" equ "false" ( + echo Compatible devices are listed in compactable_list.txt echo Your device: %device% pause exit /B 1 ) -:main_menu cls echo ======================================================== echo Fastboot Flasher echo ======================================================== echo Device detected: %device% echo -------------------------------------------------------- -echo Main Menu: -echo 1. Flash ROM -echo 2. Additional Options -echo 3. Exit / Reboot -echo ======================================================== -set /p option=Enter your choice (1/2/3): -echo. - -if "%option%" equ "1" ( - call :flash_rom -) else if "%option%" equ "2" ( - call :additional_options -) else if "%option%" equ "3" ( - fastboot reboot - echo Exiting script. - pause - exit -) else ( - echo Invalid option. Please enter a valid option. - goto main_menu -) -:flash_rom echo Do you want to format data? (Y/N) set /p formatData= @@ -69,7 +52,7 @@ if /i "%formatData%" equ "Y" ( ) else ( echo Skipping data formatting. ) - +:boot_menu echo Boot Type: echo 1. Magisk [magisk_boot.img] echo 2. Default [boot.img] @@ -87,40 +70,34 @@ if "%bootChoice%" equ "1" ( ) else ( echo Invalid boot image selection. Please select a valid boot. timeout /nobreak /t 5 >nul 2>&1 - goto flash_rom + goto boot_menu ) cd %imagesPath% echo Verifying critical images... -if not exist boot.img ( - echo boot.img is missing. Aborting. +if not exist %bootImage% ( + echo Selected boot image is missing. Aborting. pause - call :main_menu + exit ) if not exist vendor_boot.img ( echo vendor_boot.img is missing. Aborting. pause - call :main_menu + exit ) echo Verifying additional images... -set "requiredImages=apusys.img audio_dsp.img ccu.img dpm.img dtbo.img gpueb.img gz.img lk.img mcf_ota.img mcupm.img md1img.img mvpu_algo.img pi_img.img scp.img spmfw.img sspm.img tee.img vcp.img vbmeta.img vendor_boot.img vbmeta_system.img vbmeta_vendor.img" -set "additionalRequiredImages=super.img" +set "requiredImages=dtbo.img vbmeta.img vendor_boot.img vbmeta_system.img super.img" setlocal enabledelayedexpansion set "missingImages=" -set "allRequiredImages=%requiredImages% %additionalRequiredImages%" -for %%i in (%allRequiredImages%) do ( +for %%i in (%requiredImages%) do ( if not exist %%i ( set "missingImages=!missingImages! %%i " ) ) -if not exist preloader_xaga.bin if not exist preloader_xaga.img if not exist preloader_raw.img ( - set "missingImages=!missingImages! preloader_xaga.bin preloader_xaga.img preloader_raw.img" -) - if not "!missingImages!"=="" ( echo Missing images: !missingImages! echo. @@ -128,51 +105,23 @@ if not "!missingImages!"=="" ( echo Type "yes" to continue. set /p continue= if /i "!continue!" neq "yes" ( - echo Returning to main menu. + echo Aborting operation. pause endlocal - call :main_menu + exit ) ) echo Flashing all images... - -for %%i in (%requiredImages%) do ( - echo Flashing %%i... - fastboot flash %%~ni_a %%i - echo %%i flashed successfully. -) - -if exist logo.img ( - echo Flashing logo... - fastboot flash logo_a logo.img - echo Logo flashed successfully. -) - -if exist %imagesPath%\preloader_xaga.bin ( - echo Flashing preloader... - fastboot flash preloader1 preloader_xaga.bin - fastboot flash preloader2 preloader_xaga.bin - echo Preloader flashed successfully. -) else ( - if exist %imagesPath%\preloader_xaga.img ( - echo Flashing preloader... - fastboot flash preloader1 preloader_xaga.img - fastboot flash preloader2 preloader_xaga.img - echo Preloader flashed successfully. - ) else ( - if exist %imagesPath%\preloader_raw.img ( - echo Flashing preloader... - fastboot flash preloader1 preloader_raw.img - fastboot flash preloader2 preloader_raw.img - echo Preloader flashed successfully. - ) else ( - echo No preloader file found. - ) +for %%i in (*.img) do ( + set imgName=%%~ni + if /i "%%~nxi" neq "boot.img" if /i "%%~nxi" neq "magisk_boot.img" if /i "%%~nxi" neq "super.img" ( + echo Flashing %%i... + fastboot flash !imgName!_a %%i + echo %%i flashed successfully. ) ) - echo Flashing boot image... fastboot flash boot_a %bootImage% echo %bootImage% flashed successfully. @@ -185,121 +134,7 @@ echo Setting active slot... fastboot set_active a echo Slot a activated successfully. -echo Press Enter to reboot and return to main menu. +echo Press Enter to reboot. pause fastboot reboot -call :main_menu - -:additional_options -cls -echo ======================================================== -echo Additional Options -echo ======================================================== -echo 1. Flash Boot Image -echo 2. Flash Vendor Boot -echo 3. Format Data -echo 4. Custom Command -echo 5. Return to Main Menu -echo ======================================================== -set /p option=Enter your choice (1/2/3/4/5): -echo. - -if "%option%" equ "1" ( - call :flash_boot -) else if "%option%" equ "2" ( - call :flash_vendor_boot -) else if "%option%" equ "3" ( - call :format_data -) else if "%option%" equ "4" ( - call :custom_command -) else if "%option%" equ "5" ( - call :main_menu -) else ( - echo Invalid option. Please enter a valid option. - goto additional_options -) - -:flash_boot -cd %imagesPath% -echo Boot Type: -echo 1. Magisk [magisk_boot.img] -echo 2. Default [boot.img] -echo. -echo Select boot image type: -set /p bootChoice= -echo. - -if "%bootChoice%" equ "1" ( - set bootImage=magisk_boot.img - echo Selected magisk_boot.img -) else if "%bootChoice%" equ "2" ( - set bootImage=boot.img - echo Selected boot.img -) else ( - echo Invalid boot image selection. Please select a valid boot. - timeout /nobreak /t 5 >nul 2>&1 - goto flash_boot -) - -if exist %imagesPath%\%bootImage% ( - echo Flashing %bootImage%... - fastboot flash boot_a %bootImage% - echo %bootImage% flashed successfully. -) else ( - echo %bootImage% not found. -) - -pause -call :additional_options - -:flash_vendor_boot -cd %imagesPath% -echo Vendor Boot Type: -echo 1. Stock Vendor Boot [vendor_boot.img] -echo 2. TWRP Vendor Boot [twrp_vendor_boot.img] -echo. -echo Select vendor boot image type: -set /p vendorBootChoice= -echo. - -if "%vendorBootChoice%" equ "1" ( - set vendorBootImage=vendor_boot.img - echo Selected vendor_boot.img -) else if "%vendorBootChoice%" equ "2" ( - set vendorBootImage=twrp_vendor_boot.img - echo Selected twrp_vendor_boot.img -) else ( - echo Invalid vendor boot image selection. Please select a valid vendor boot. - timeout /nobreak /t 5 >nul 2>&1 - goto flash_vendor_boot -) - -if exist %imagesPath%\%vendorBootImage% ( - echo Flashing %vendorBootImage%... - fastboot flash vendor_boot_a %vendorBootImage% - echo %vendorBootImage% flashed successfully. -) else ( - echo %vendorBootImage% not found. -) - -pause -call :additional_options - -:format_data -echo Formatting data... -fastboot erase metadata -fastboot erase userdata -echo Data formatted successfully. -pause -call :additional_options - -:custom_command -cd %imagesPath% -echo Enter the command you want to execute: -set /p customCommand= -echo. - -echo Executing command: %customCommand% -%customCommand% -pause -call :additional_options +exit \ No newline at end of file diff --git a/quick_install.bat b/quick_install.bat deleted file mode 100644 index 6ffd4bf..0000000 --- a/quick_install.bat +++ /dev/null @@ -1,147 +0,0 @@ -@echo off -cls -echo ======================================================== -echo Fastboot Flasher -echo ======================================================== -echo Connect your device in fastboot mode. -echo -------------------------------------------------------- -echo Waiting for device... -setlocal -set "SCRIPT_PATH=%~dp0" -set "TOOLS=%SCRIPT_PATH%tools\windows\platform-tools" -set PATH=%PATH%;%TOOLS% -if not exist %SCRIPT_PATH%\images mkdir %SCRIPT_PATH%\images -set "imagesPath=%SCRIPT_PATH%\images" - -:wait_for_device -set device=unknown -for /f "tokens=2" %%D in ('fastboot getvar product 2^>^&1 ^| findstr /l /b /c:"product:"') do set device=%%D -if "%device%" equ "unknown" ( - echo No device detected. Waiting for device... - timeout /t 5 >nul - goto wait_for_device -) -if "%device%" neq "xaga" if "%device%" neq "xagapro" if "%device%" neq "xagain" ( - echo Compatible devices: xaga, xagapro, xagain - echo Your device: %device% - pause - exit /B 1 -) - -cls -echo ======================================================== -echo Fastboot Flasher -echo ======================================================== -echo Device detected: %device% -echo -------------------------------------------------------- - -echo Do you want to format data? (Y/N) -set /p formatData= - -if /i "%formatData%" equ "Y" ( - echo Formatting data... - fastboot erase metadata - fastboot erase userdata - echo Data formatted successfully. -) else ( - echo Skipping data formatting. -) - -cd %imagesPath% -echo Verifying critical images... -if not exist boot.img ( - echo boot.img is missing. Aborting. - pause - exit -) -if not exist vendor_boot.img ( - echo vendor_boot.img is missing. Aborting. - pause - exit -) - -echo Verifying additional images... -set "requiredImages=apusys.img audio_dsp.img ccu.img dpm.img dtbo.img gpueb.img gz.img lk.img mcf_ota.img mcupm.img md1img.img mvpu_algo.img pi_img.img scp.img spmfw.img sspm.img tee.img vcp.img vbmeta.img vendor_boot.img vbmeta_system.img vbmeta_vendor.img" -set "additionalRequiredImages=super.img" -setlocal enabledelayedexpansion - -set "missingImages=" -set "allRequiredImages=%requiredImages% %additionalRequiredImages%" - -for %%i in (%allRequiredImages%) do ( - if not exist %%i ( - set "missingImages=!missingImages! %%i " - ) -) - -if not exist preloader_xaga.bin if not exist preloader_xaga.img if not exist preloader_raw.img ( - set "missingImages=!missingImages! preloader_xaga.bin preloader_xaga.img preloader_raw.img" -) - -if not "!missingImages!"=="" ( - echo Missing images: !missingImages! - echo. - echo Some required images are missing. Do you want to continue anyway? - echo Type "yes" to continue. - set /p continue= - if /i "!continue!" neq "yes" ( - echo Aborting operation. - pause - endlocal - exit - ) -) - -echo Flashing all images... - -for %%i in (%requiredImages%) do ( - echo Flashing %%i... - fastboot flash %%~ni_a %%i - echo %%i flashed successfully. -) - -if exist logo.img ( - echo Flashing logo... - fastboot flash logo_a logo.img - echo Logo flashed successfully. -) - -if exist %imagesPath%\preloader_xaga.bin ( - echo Flashing preloader... - fastboot flash preloader1 preloader_xaga.bin - fastboot flash preloader2 preloader_xaga.bin - echo Preloader flashed successfully. -) else ( - if exist %imagesPath%\preloader_xaga.img ( - echo Flashing preloader... - fastboot flash preloader1 preloader_xaga.img - fastboot flash preloader2 preloader_xaga.img - echo Preloader flashed successfully. - ) else ( - if exist %imagesPath%\preloader_raw.img ( - echo Flashing preloader... - fastboot flash preloader1 preloader_raw.img - fastboot flash preloader2 preloader_raw.img - echo Preloader flashed successfully. - ) else ( - echo No preloader file found. - ) - ) -) - -echo Flashing boot image... -fastboot flash boot_a %bootImage% -echo %bootImage% flashed successfully. - -echo Flashing system image... -fastboot flash super super.img -echo super.img flashed successfully. - -echo Setting active slot... -fastboot set_active a -echo Slot a activated successfully. - -echo Press Enter to reboot. -pause -fastboot reboot -exit \ No newline at end of file