From 0b81a7aec10ccddb12bcb16f224ac8ac7ed38cf5 Mon Sep 17 00:00:00 2001 From: Rohit Date: Wed, 16 Nov 2022 14:27:45 +0530 Subject: [PATCH] flash_FP{3,4}_factory.sh: Properly quote $FASTBOOT_BIN * Otherwise flashing from paths with spaces will error out --- flash_FP3_factory.sh | 8 ++++---- flash_FP4_factory.sh | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flash_FP3_factory.sh b/flash_FP3_factory.sh index 59669b0..71c9b99 100755 --- a/flash_FP3_factory.sh +++ b/flash_FP3_factory.sh @@ -41,10 +41,10 @@ find_device() { do serial_numbers= - for sn in $(${FASTBOOT_BIN} devices | grep fastboot | grep -oE '^[[:alnum:]]+') + for sn in $("${FASTBOOT_BIN}" devices | grep fastboot | grep -oE '^[[:alnum:]]+') do # Checking the product ID - PRODUCT_STRING=$(${FASTBOOT_BIN} -s "${sn}" getvar product 2>&1) + PRODUCT_STRING=$("${FASTBOOT_BIN}" -s "${sn}" getvar product 2>&1) # Add serial, if product matches if [[ ${PRODUCT_STRING} == *"${PRODUCT_ID}"* ]] || [[ ${PRODUCT_STRING} == *"${PRODUCT_ID_OLD}"* ]] then @@ -114,7 +114,7 @@ flash_device() { flash_image_or_abort "${sn}" userdata "${IMAGES_DIR}/userdata.img" fi - $FASTBOOT_BIN -s "${sn}" --set-active=a + "$FASTBOOT_BIN" -s "${sn}" --set-active=a echo "INFO: Locking bootloader" "${FASTBOOT_BIN}" -s "${sn}" oem lock @@ -134,7 +134,7 @@ flash_device() { # Arguments: flash_image_or_abort() { local retval=0 - $FASTBOOT_BIN -s "${1}" flash "${2}" "${3}" || retval=$? + "$FASTBOOT_BIN" -s "${1}" flash "${2}" "${3}" || retval=$? if [ "${retval}" -ne 0 ] then diff --git a/flash_FP4_factory.sh b/flash_FP4_factory.sh index 1a7cc10..fa35ef4 100755 --- a/flash_FP4_factory.sh +++ b/flash_FP4_factory.sh @@ -37,10 +37,10 @@ find_device() { do serial_numbers= - for sn in $(${FASTBOOT_BIN} devices | grep fastboot | grep -oE '^[[:alnum:]]+') + for sn in $("${FASTBOOT_BIN}" devices | grep fastboot | grep -oE '^[[:alnum:]]+') do # Checking the product ID - PRODUCT_STRING=$(${FASTBOOT_BIN} -s "${sn}" getvar product 2>&1) + PRODUCT_STRING=$("${FASTBOOT_BIN}" -s "${sn}" getvar product 2>&1) # Add serial, if product matches if [[ ${PRODUCT_STRING} == *"${PRODUCT_ID}"* ]] || [[ ${PRODUCT_STRING} == *"${PRODUCT_ID_OLD}"* ]] then @@ -111,10 +111,10 @@ flash_device() { flash_image_ab_or_abort "${sn}" xbl_config "${IMAGES_DIR}/xbl_config.img" flash_image_ab_or_abort "${sn}" core_nhlos "${IMAGES_DIR}/core_nhlos.img" - $FASTBOOT_BIN -s "${sn}" erase userdata - $FASTBOOT_BIN -s "${sn}" erase metadata + "$FASTBOOT_BIN" -s "${sn}" erase userdata + "$FASTBOOT_BIN" -s "${sn}" erase metadata - $FASTBOOT_BIN -s "${sn}" --set-active=a + "$FASTBOOT_BIN" -s "${sn}" --set-active=a } @@ -122,7 +122,7 @@ flash_device() { # Arguments: flash_image_or_abort() { local retval=0 - $FASTBOOT_BIN -s "${1}" flash "${2}" "${3}" || retval=$? + "$FASTBOOT_BIN" -s "${1}" flash "${2}" "${3}" || retval=$? if [ "${retval}" -ne 0 ] then -- GitLab