Loading flash-scripts/windows/fp4_check_bootloader.bat 0 → 100644 +80 −0 Original line number Diff line number Diff line :: Copyright (C) 2020 - Author: Ingo; update and adoption to FP4, 2022 by ff2u :: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: This program is free software: you can redistribute it and/or modify :: it under the terms of the GNU General Public License as published by :: the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see <https://www.gnu.org/licenses/>. :: Parameter :: $1: ARCHIVE_PATH path to the /e/ archive to flash :: $2: The archive folder :: $3: The device model :: Exit status :: - 0 : Fine :: - 1 : Error @echo OFF set FASTBOOT_FOLDER_PATH=%~1 set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" echo "FASTBOOT path:"%FASTBOOT_PATH% ::----------- set ARCHIVE_PATH=%~2 echo "Archive Path=%ARCHIVE_PATH%" for %%a in ("%ARCHIVE_PATH%") do ( set ARCHIVE_FOLDER_PATH="%%~dpa ) echo "Archive Folder Path="%ARCHIVE_FOLDER_PATH% set device_model=%~3 echo "Model=%device_model%" set SECURITY_PATCH=%ARCHIVE_FOLDER_PATH%%device_model%-security-patch" set /p ORIGINAL_SECURITY_PATCH=<%SECURITY_PATCH% call:versionToInt %ORIGINAL_SECURITY_PATCH% set I_ORIGINAL_SECURITY_PATCH=%var1% echo "I_ORIGINAL_SECURITY_PATCH====>%I_ORIGINAL_SECURITY_PATCH%" set MURENA__SECURITY_PATCH=2021-12-05 call:versionToInt %MURENA__SECURITY_PATCH% set I_MURENA__SECURITY_PATCH=%var1% echo "I_MURENA__SECURITY_PATCH====>%I_MURENA__SECURITY_PATCH%" if %I_MURENA__SECURITY_PATCH% GEQ %I_ORIGINAL_SECURITY_PATCH% ( echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" ) else ( echo "LOWER DO NOT PROCESS" waitfor /t 30 pause 2>nul ) exit /b 0 :: ------------------ :: Assuming format is xxxx-yy-zz with otional will return xxyyzz :versionToInt setlocal enabledelayedexpansion set str_sum= set version=%~1 set version=%version:-= % for %%a in (%version%) do ( set "formattedValue=000000%%a" set str_sum=!str_sum!!formattedValue:~-2! ) ( endlocal set "var1=%str_sum%" ) goto:eof flash-scripts/windows/store-rom-info.bat 0 → 100644 +78 −0 Original line number Diff line number Diff line :: Copyright (C) 2022 - Author: Frank :: :: This program is free software: you can redistribute it and/or modify :: it under the terms of the GNU General Public License as published by :: the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see <https://www.gnu.org/licenses/>. :: :: TODO: What if 2 devices detected? :: Parameter :: $1: The folder where fastboot runnable is stored :: $2: The archive folder :: $3: The device model :: :: Exit status :: - 0 : Device in fastboot mode detected :: - 1 : Error (adb) :: - 2 : Error (device locked) :: Store ROM information on the file system @echo OFF set FASTBOOT_FOLDER_PATH="%~1" set ADB_PATH=%FASTBOOT_FOLDER_PATH%adb echo "adb command=%ADB_PATH%"" set ARCHIVE_PATH=%~2 echo "Archive Path=%ARCHIVE_PATH%" for %%a in ("%ARCHIVE_PATH%") do ( set ARCHIVE_FOLDER_PATH="%%~dpa" ) echo "Archive Folder Path="%ARCHIVE_FOLDER_PATH% set device_model=%~3 echo "Model=%device_model%" %ADB_PATH% shell getprop ro.build.version.security_patch if errorLevel 1 ( echo "adb error (1)" exit /b 1 ) set SECURITY_PATCH=%ARCHIVE_FOLDER_PATH%%device_model%-security-patch set DEVICE_STATE=%ARCHIVE_FOLDER_PATH%%device_model%-device-state :: The command below may provide empty result if the key does not exists :: In that case the process will use for compare. %ADB_PATH% shell getprop ro.build.version.security_patch> %SECURITY_PATCH% :: For FP4 on stock ROM the key [ro.build.device] is [FP4] let's use this to check if we are on stock ROM:: On Murena OS the return is empty %ADB_PATH% shell getprop ro.build.device 2>&1 | findstr "%device_model%" if errorLevel 1 ( ::We are NOT on a stock ROM let's assume the job (unlock) is done and continue the process. echo "Custom ROM case" exit /b 0 ) echo "Stock ROM" %ADB_PATH% shell getprop ro.boot.vbmeta.device_state 2>&1 | findstr "unlocked" if errorLevel 1 ( echo "The device is locked" exit /b 2 ) exit /b 0 Loading
flash-scripts/windows/fp4_check_bootloader.bat 0 → 100644 +80 −0 Original line number Diff line number Diff line :: Copyright (C) 2020 - Author: Ingo; update and adoption to FP4, 2022 by ff2u :: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: This program is free software: you can redistribute it and/or modify :: it under the terms of the GNU General Public License as published by :: the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see <https://www.gnu.org/licenses/>. :: Parameter :: $1: ARCHIVE_PATH path to the /e/ archive to flash :: $2: The archive folder :: $3: The device model :: Exit status :: - 0 : Fine :: - 1 : Error @echo OFF set FASTBOOT_FOLDER_PATH=%~1 set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" echo "FASTBOOT path:"%FASTBOOT_PATH% ::----------- set ARCHIVE_PATH=%~2 echo "Archive Path=%ARCHIVE_PATH%" for %%a in ("%ARCHIVE_PATH%") do ( set ARCHIVE_FOLDER_PATH="%%~dpa ) echo "Archive Folder Path="%ARCHIVE_FOLDER_PATH% set device_model=%~3 echo "Model=%device_model%" set SECURITY_PATCH=%ARCHIVE_FOLDER_PATH%%device_model%-security-patch" set /p ORIGINAL_SECURITY_PATCH=<%SECURITY_PATCH% call:versionToInt %ORIGINAL_SECURITY_PATCH% set I_ORIGINAL_SECURITY_PATCH=%var1% echo "I_ORIGINAL_SECURITY_PATCH====>%I_ORIGINAL_SECURITY_PATCH%" set MURENA__SECURITY_PATCH=2021-12-05 call:versionToInt %MURENA__SECURITY_PATCH% set I_MURENA__SECURITY_PATCH=%var1% echo "I_MURENA__SECURITY_PATCH====>%I_MURENA__SECURITY_PATCH%" if %I_MURENA__SECURITY_PATCH% GEQ %I_ORIGINAL_SECURITY_PATCH% ( echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" ) else ( echo "LOWER DO NOT PROCESS" waitfor /t 30 pause 2>nul ) exit /b 0 :: ------------------ :: Assuming format is xxxx-yy-zz with otional will return xxyyzz :versionToInt setlocal enabledelayedexpansion set str_sum= set version=%~1 set version=%version:-= % for %%a in (%version%) do ( set "formattedValue=000000%%a" set str_sum=!str_sum!!formattedValue:~-2! ) ( endlocal set "var1=%str_sum%" ) goto:eof
flash-scripts/windows/store-rom-info.bat 0 → 100644 +78 −0 Original line number Diff line number Diff line :: Copyright (C) 2022 - Author: Frank :: :: This program is free software: you can redistribute it and/or modify :: it under the terms of the GNU General Public License as published by :: the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see <https://www.gnu.org/licenses/>. :: :: TODO: What if 2 devices detected? :: Parameter :: $1: The folder where fastboot runnable is stored :: $2: The archive folder :: $3: The device model :: :: Exit status :: - 0 : Device in fastboot mode detected :: - 1 : Error (adb) :: - 2 : Error (device locked) :: Store ROM information on the file system @echo OFF set FASTBOOT_FOLDER_PATH="%~1" set ADB_PATH=%FASTBOOT_FOLDER_PATH%adb echo "adb command=%ADB_PATH%"" set ARCHIVE_PATH=%~2 echo "Archive Path=%ARCHIVE_PATH%" for %%a in ("%ARCHIVE_PATH%") do ( set ARCHIVE_FOLDER_PATH="%%~dpa" ) echo "Archive Folder Path="%ARCHIVE_FOLDER_PATH% set device_model=%~3 echo "Model=%device_model%" %ADB_PATH% shell getprop ro.build.version.security_patch if errorLevel 1 ( echo "adb error (1)" exit /b 1 ) set SECURITY_PATCH=%ARCHIVE_FOLDER_PATH%%device_model%-security-patch set DEVICE_STATE=%ARCHIVE_FOLDER_PATH%%device_model%-device-state :: The command below may provide empty result if the key does not exists :: In that case the process will use for compare. %ADB_PATH% shell getprop ro.build.version.security_patch> %SECURITY_PATCH% :: For FP4 on stock ROM the key [ro.build.device] is [FP4] let's use this to check if we are on stock ROM:: On Murena OS the return is empty %ADB_PATH% shell getprop ro.build.device 2>&1 | findstr "%device_model%" if errorLevel 1 ( ::We are NOT on a stock ROM let's assume the job (unlock) is done and continue the process. echo "Custom ROM case" exit /b 0 ) echo "Stock ROM" %ADB_PATH% shell getprop ro.boot.vbmeta.device_state 2>&1 | findstr "unlocked" if errorLevel 1 ( echo "The device is locked" exit /b 2 ) exit /b 0