diff --git a/device_specific/flash_the_m5stack_core_basic b/device_specific/flash_the_m5stack_core_basic index d33f64a..17ca126 100755 --- a/device_specific/flash_the_m5stack_core_basic +++ b/device_specific/flash_the_m5stack_core_basic @@ -42,19 +42,17 @@ fi echo "LINUX ONLY. Flashing the ${chosen_device}..." -if ! command -v cmake &> /dev/null; then - echo -e "\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" - exit 1 -elif ! command -v git &> /dev/null; then - echo -e "\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" - exit 1 -elif ! command -v pip &> /dev/null; then - echo -e "\n\RROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" - exit 1 -elif ! command -v virtualenv &> /dev/null; then - echo -e "\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" - exit 1 -fi +while read -r dependency; do + if ! command -v "${dependency}" &> /dev/null; then + echo -en "\n\nERROR:\n${dependency} was not found on your system.\nPlease install ${dependency} by running:\n\n" + if [ "${dependency}" == "pip" ] || [ "${dependency}" == "virtualenv" ]; then + echo -en "sudo apt update && sudo apt install -y python3-${dependency}\n\n" + else + echo -en "sudo apt update && sudo apt install -y ${dependency}\n\n" + fi + exit 1 + fi +done < <(curl -fsSL https://github.com/epiccurious/jade-diy/raw/master/depends.txt) if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then git clone --branch "${esp_idf_git_tag}" --single-branch --depth 1 "${esp_idf_repo_url}" "${esp_idf_temp_directory}" diff --git a/device_specific/flash_the_m5stack_fire b/device_specific/flash_the_m5stack_fire index ffee231..f640271 100755 --- a/device_specific/flash_the_m5stack_fire +++ b/device_specific/flash_the_m5stack_fire @@ -42,19 +42,17 @@ fi echo "LINUX ONLY. Flashing the ${chosen_device}..." -if ! command -v cmake &> /dev/null; then - echo -e "\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" - exit 1 -elif ! command -v git &> /dev/null; then - echo -e "\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" - exit 1 -elif ! command -v pip &> /dev/null; then - echo -e "\n\RROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" - exit 1 -elif ! command -v virtualenv &> /dev/null; then - echo -e "\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" - exit 1 -fi +while read -r dependency; do + if ! command -v "${dependency}" &> /dev/null; then + echo -en "\n\nERROR:\n${dependency} was not found on your system.\nPlease install ${dependency} by running:\n\n" + if [ "${dependency}" == "pip" ] || [ "${dependency}" == "virtualenv" ]; then + echo -en "sudo apt update && sudo apt install -y python3-${dependency}\n\n" + else + echo -en "sudo apt update && sudo apt install -y ${dependency}\n\n" + fi + exit 1 + fi +done < <(curl -fsSL https://github.com/epiccurious/jade-diy/raw/master/depends.txt) if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then git clone --branch "${esp_idf_git_tag}" --single-branch --depth 1 "${esp_idf_repo_url}" "${esp_idf_temp_directory}" diff --git a/device_specific/flash_the_m5stack_m5stickc_plus b/device_specific/flash_the_m5stack_m5stickc_plus index 525b327..b57eea2 100755 --- a/device_specific/flash_the_m5stack_m5stickc_plus +++ b/device_specific/flash_the_m5stack_m5stickc_plus @@ -42,19 +42,17 @@ fi echo "LINUX ONLY. Flashing the ${chosen_device}..." -if ! command -v cmake &> /dev/null; then - echo -e "\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" - exit 1 -elif ! command -v git &> /dev/null; then - echo -e "\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" - exit 1 -elif ! command -v pip &> /dev/null; then - echo -e "\n\RROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" - exit 1 -elif ! command -v virtualenv &> /dev/null; then - echo -e "\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" - exit 1 -fi +while read -r dependency; do + if ! command -v "${dependency}" &> /dev/null; then + echo -en "\n\nERROR:\n${dependency} was not found on your system.\nPlease install ${dependency} by running:\n\n" + if [ "${dependency}" == "pip" ] || [ "${dependency}" == "virtualenv" ]; then + echo -en "sudo apt update && sudo apt install -y python3-${dependency}\n\n" + else + echo -en "sudo apt update && sudo apt install -y ${dependency}\n\n" + fi + exit 1 + fi +done < <(curl -fsSL https://github.com/epiccurious/jade-diy/raw/master/depends.txt) if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then git clone --branch "${esp_idf_git_tag}" --single-branch --depth 1 "${esp_idf_repo_url}" "${esp_idf_temp_directory}" diff --git a/device_specific/flash_the_ttgo_tdisplay b/device_specific/flash_the_ttgo_tdisplay index d1cbe00..6b822a3 100755 --- a/device_specific/flash_the_ttgo_tdisplay +++ b/device_specific/flash_the_ttgo_tdisplay @@ -42,19 +42,17 @@ fi echo "LINUX ONLY. Flashing the ${chosen_device}..." -if ! command -v cmake &> /dev/null; then - echo -e "\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" - exit 1 -elif ! command -v git &> /dev/null; then - echo -e "\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" - exit 1 -elif ! command -v pip &> /dev/null; then - echo -e "\n\RROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" - exit 1 -elif ! command -v virtualenv &> /dev/null; then - echo -e "\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" - exit 1 -fi +while read -r dependency; do + if ! command -v "${dependency}" &> /dev/null; then + echo -en "\n\nERROR:\n${dependency} was not found on your system.\nPlease install ${dependency} by running:\n\n" + if [ "${dependency}" == "pip" ] || [ "${dependency}" == "virtualenv" ]; then + echo -en "sudo apt update && sudo apt install -y python3-${dependency}\n\n" + else + echo -en "sudo apt update && sudo apt install -y ${dependency}\n\n" + fi + exit 1 + fi +done < <(curl -fsSL https://github.com/epiccurious/jade-diy/raw/master/depends.txt) if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then git clone --branch "${esp_idf_git_tag}" --single-branch --depth 1 "${esp_idf_repo_url}" "${esp_idf_temp_directory}" diff --git a/flash_your_device b/flash_your_device index 555213d..3075440 100755 --- a/flash_your_device +++ b/flash_your_device @@ -48,19 +48,17 @@ Linux*) machine="Linux" echo "Detected ${machine}." echo -n "Checking for dependencies... " - if ! command -v cmake &> /dev/null; then - echo -e "\n\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" - exit 1 - elif ! command -v git &> /dev/null; then - echo -e "\n\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" - exit 1 - elif ! command -v pip &> /dev/null; then - echo -e "\n\nERROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" - exit 1 - elif ! command -v virtualenv &> /dev/null; then - echo -e "\n\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" - exit 1 - fi + while read -r dependency; do + if ! command -v "${dependency}" &> /dev/null; then + echo -en "\n\nERROR:\n${dependency} was not found on your system.\nPlease install ${dependency} by running:\n\n" + if [ "${dependency}" == "pip" ] || [ "${dependency}" == "virtualenv" ]; then + echo -en "sudo apt update && sudo apt install -y python3-${dependency}\n\n" + else + echo -en "sudo apt update && sudo apt install -y ${dependency}\n\n" + fi + exit 1 + fi + done < <(curl -fsSL https://github.com/epiccurious/jade-diy/raw/master/depends.txt) echo "ok." ;; Darwin*)