Loading flash/factory.common +33 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,36 @@ abort_now() { exit 1 } # Check if the device is properly unlocked check_unlock_status() { local PHONE_IS_READY=true if ("${FASTBOOT_BIN}" getvar is-userspace 2>&1 | grep -q yes); then echo "Info: Your phone is in fastbootD mode." if ("${FASTBOOT_BIN}" getvar unlocked 2>&1 | grep -q no); then echo "Error: Your device's bootloader is still locked." echo "Please follow the instructions to unlock the bootloader!" PHONE_IS_READY=false fi else echo "Info: Your phone is in regular bootloader mode." if ("${FASTBOOT_BIN}" getvar unlocked 2>&1 | grep -q no); then echo "Error: Your device's bootloader is still locked." echo "Please follow the instructions to unlock the bootloader!" PHONE_IS_READY=false fi if ("${FASTBOOT_BIN}" oem device-info 2>&1 | grep -q "critical unlocked: false"); then echo "Error: Critical partitions are still locked." echo "Did you execute 'fastboot flashing unlock_critical'?" PHONE_IS_READY=false fi fi if [ "$PHONE_IS_READY" = "false" ]; then echo "Error: Your phone is not ready for flashing yet (see above), aborting..." exit 1 fi } # Erase a list of partitions. Abort on failure. # Arguments: <device serial number> <partition_name1 partition_name2> erase_images_or_abort() { Loading Loading @@ -141,6 +171,9 @@ flash_factory() { switch_to_fastbootd fi # Check if the device is properly unlocked check_unlock_status # Flash the device flash_device Loading Loading
flash/factory.common +33 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,36 @@ abort_now() { exit 1 } # Check if the device is properly unlocked check_unlock_status() { local PHONE_IS_READY=true if ("${FASTBOOT_BIN}" getvar is-userspace 2>&1 | grep -q yes); then echo "Info: Your phone is in fastbootD mode." if ("${FASTBOOT_BIN}" getvar unlocked 2>&1 | grep -q no); then echo "Error: Your device's bootloader is still locked." echo "Please follow the instructions to unlock the bootloader!" PHONE_IS_READY=false fi else echo "Info: Your phone is in regular bootloader mode." if ("${FASTBOOT_BIN}" getvar unlocked 2>&1 | grep -q no); then echo "Error: Your device's bootloader is still locked." echo "Please follow the instructions to unlock the bootloader!" PHONE_IS_READY=false fi if ("${FASTBOOT_BIN}" oem device-info 2>&1 | grep -q "critical unlocked: false"); then echo "Error: Critical partitions are still locked." echo "Did you execute 'fastboot flashing unlock_critical'?" PHONE_IS_READY=false fi fi if [ "$PHONE_IS_READY" = "false" ]; then echo "Error: Your phone is not ready for flashing yet (see above), aborting..." exit 1 fi } # Erase a list of partitions. Abort on failure. # Arguments: <device serial number> <partition_name1 partition_name2> erase_images_or_abort() { Loading Loading @@ -141,6 +171,9 @@ flash_factory() { switch_to_fastbootd fi # Check if the device is properly unlocked check_unlock_status # Flash the device flash_device Loading