Skip to content

Commit

Permalink
drop quick_install.bat, made universal & remove unwanted
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefino9488 committed Oct 24, 2024
1 parent 478a718 commit 45bfba2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 338 deletions.
217 changes: 26 additions & 191 deletions installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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=

Expand All @@ -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]
Expand All @@ -87,92 +70,58 @@ 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.
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 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.
Expand All @@ -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
Loading

0 comments on commit 45bfba2

Please sign in to comment.