From f130ff4a66268b78437a649869269dacb5cedd5e Mon Sep 17 00:00:00 2001 From: Bharath Date: Thu, 8 Sep 2022 09:57:22 +0530 Subject: [PATCH] Add support for Windows as well * Changes in documentation now mentions the dependency on Git Bash for Windows. Change-Id: I1b5ca1a41daa2f2c1586c9d47d52e958be281a76 --- flash_FP3_factory.sh | 17 +++++++++++++++-- flash_FP4_factory.sh | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/flash_FP3_factory.sh b/flash_FP3_factory.sh index 33157d7..09e9eef 100755 --- a/flash_FP3_factory.sh +++ b/flash_FP3_factory.sh @@ -150,8 +150,21 @@ flash_image_ab_or_abort() { # Operating system checks and variable definition os_checks() { - echo "INFO: You are using a Linux distribution." - FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + case "$(uname -s 2> /dev/null)" in + Linux|GNU/Linux) + echo "INFO: You are using a Linux distribution." + FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + ;; + msys|MINGW*) + echo "INFO: You are using MinGW on Windows" + FASTBOOT_BIN="${ROOT_DIR}/bin-msys/fastboot.exe" + ;; + *) + echo "ERROR: Unsupported operating system (${OSTYPE})." + echo "ERROR: Only GNU/Linux, and MinGW on Windows are currently supported." + abort_now + ;; + esac } diff --git a/flash_FP4_factory.sh b/flash_FP4_factory.sh index e71e586..1a7cc10 100755 --- a/flash_FP4_factory.sh +++ b/flash_FP4_factory.sh @@ -146,8 +146,21 @@ flash_image_ab_or_abort() { # Operating system checks and variable definition os_checks() { - echo "INFO: You are using a Linux distribution." - FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + case "$(uname -s 2> /dev/null)" in + Linux|GNU/Linux) + echo "INFO: You are using a Linux distribution." + FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + ;; + msys|MINGW*) + echo "INFO: You are using MinGW on Windows" + FASTBOOT_BIN="${ROOT_DIR}/bin-msys/fastboot.exe" + ;; + *) + echo "ERROR: Unsupported operating system (${OSTYPE})." + echo "ERROR: Only GNU/Linux, and MinGW on Windows are currently supported." + abort_now + ;; + esac } # Control the reboot sequence -- GitLab