Loading flash-scripts/linux/fp4_check_bootloader.sh 0 → 100755 +58 −0 Original line number Diff line number Diff line #!/bin/bash # 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 path # $3: THe model of the device # Exit status # - 0 : Device in fastboot mode detected # Store ROM information on the file system FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" sleep 30 fi exit 0 No newline at end of file flash-scripts/linux/fp4_lock.sh +29 −1 Original line number Diff line number Diff line #!/bin/bash # Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer # Copyright (C) 2020-2022 ECORP SAS - Author: Vincent Bourgmayer, 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 Loading @@ -18,6 +18,8 @@ # Parameter # $1: ADB_FOLDER_PATH: the path where runnable adb is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : success Loading @@ -30,6 +32,32 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" exit 0 fi #1 On check that device is in recovery mode if ! "$FASTBOOT_PATH" devices 2>&1 | grep "fastboot" then Loading flash-scripts/linux/fp4_lock_critical.sh +31 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ # Parameter # $1: ADB_FOLDER_PATH: the path where runnable adb is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : success Loading @@ -28,6 +30,35 @@ FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" "$FASTBOOT_PATH" reboot sleep 1 exit 0 fi # Lock the bootloader if [ "$($FASTBOOT_PATH flashing lock_critical; echo $?)" = 1 ] then Loading flash-scripts/linux/store-rom-info.sh 0 → 100755 +58 −0 Original line number Diff line number Diff line #!/bin/bash # 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 # Exit status # - 0 : Device in fastboot mode detected # - 1 : Error (adb) # - 2 : Error (device locked) # Store ROM information on the file system FASTBOOT_FOLDER_PATH=$1 ADB_PATH=${FASTBOOT_FOLDER_PATH}"adb" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model if ! "$ADB_PATH" shell getprop ro.build.version.security_patch then exit 1 fi SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" 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 if "$ADB_PATH" shell getprop ro.boot.vbmeta.device_state 2>&1 | grep "unlocked" then echo "Device is unlocked" exit 0 fi exit 2 No newline at end of file flash-scripts/linux/wait-fastboot-locked.sh +28 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ # TODO: What if 2 devices detected? # Parameter # $1: The folder where fastboot runnable is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : Device in fastboot mode detected and bootloader unlocked Loading @@ -28,6 +30,32 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" exit 0 fi while [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q "unlocked: no"; echo $?)" = 1 ] do sleep 2 Loading Loading
flash-scripts/linux/fp4_check_bootloader.sh 0 → 100755 +58 −0 Original line number Diff line number Diff line #!/bin/bash # 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 path # $3: THe model of the device # Exit status # - 0 : Device in fastboot mode detected # Store ROM information on the file system FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" sleep 30 fi exit 0 No newline at end of file
flash-scripts/linux/fp4_lock.sh +29 −1 Original line number Diff line number Diff line #!/bin/bash # Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer # Copyright (C) 2020-2022 ECORP SAS - Author: Vincent Bourgmayer, 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 Loading @@ -18,6 +18,8 @@ # Parameter # $1: ADB_FOLDER_PATH: the path where runnable adb is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : success Loading @@ -30,6 +32,32 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" exit 0 fi #1 On check that device is in recovery mode if ! "$FASTBOOT_PATH" devices 2>&1 | grep "fastboot" then Loading
flash-scripts/linux/fp4_lock_critical.sh +31 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ # Parameter # $1: ADB_FOLDER_PATH: the path where runnable adb is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : success Loading @@ -28,6 +30,35 @@ FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" "$FASTBOOT_PATH" reboot sleep 1 exit 0 fi # Lock the bootloader if [ "$($FASTBOOT_PATH flashing lock_critical; echo $?)" = 1 ] then Loading
flash-scripts/linux/store-rom-info.sh 0 → 100755 +58 −0 Original line number Diff line number Diff line #!/bin/bash # 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 # Exit status # - 0 : Device in fastboot mode detected # - 1 : Error (adb) # - 2 : Error (device locked) # Store ROM information on the file system FASTBOOT_FOLDER_PATH=$1 ADB_PATH=${FASTBOOT_FOLDER_PATH}"adb" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model if ! "$ADB_PATH" shell getprop ro.build.version.security_patch then exit 1 fi SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" 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 if "$ADB_PATH" shell getprop ro.boot.vbmeta.device_state 2>&1 | grep "unlocked" then echo "Device is unlocked" exit 0 fi exit 2 No newline at end of file
flash-scripts/linux/wait-fastboot-locked.sh +28 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ # TODO: What if 2 devices detected? # Parameter # $1: The folder where fastboot runnable is stored # $2: The archive folder path # $3: THe model of the device # Exit status # - 0 : Device in fastboot mode detected and bootloader unlocked Loading @@ -28,6 +30,32 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" ARCHIVE_PATH=$2 ARCHIVE_FOLDER_PATH=$(dirname "$2")"/" echo "Archive Path="$ARCHIVE_FOLDER_PATH device_model=$3 echo "Model="$device_model SECURITY_PATCH=${ARCHIVE_FOLDER_PATH}""${device_model}"-security-patch" ORIGINAL_SECURITY_PATCH=$(cat "$SECURITY_PATCH") # Assuming format is xxxx-yy-zz with otional extra info .. function versionToInt { printf "%03d%03d%03d%03d" $(echo "$1" | tr '-' ' '); } I_ORIGINAL_SECURITY_PATCH=$(versionToInt "$ORIGINAL_SECURITY_PATCH") I_MURENA__SECURITY_PATCH=$(versionToInt 2020-12-05) if [[ $I_MURENA__SECURITY_PATCH -ge $I_ORIGINAL_SECURITY_PATCH ]] then echo "GREATER OR EQUALS OR ORIGINAL ROM INFO NOT AVAILABLE => PROCESS" else echo "LOWER DO NOT PROCESS" exit 0 fi while [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q "unlocked: no"; echo $?)" = 1 ] do sleep 2 Loading