Skip to content

Commit

Permalink
feat: install dependencies from text file (#61)
Browse files Browse the repository at this point in the history
* feat: install dependencies from text file

* refactor: improve formatting

* feat: add change to device-specific scripts
  • Loading branch information
epiccurious authored Dec 17, 2023
1 parent e7e18eb commit efd65f3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 65 deletions.
24 changes: 11 additions & 13 deletions device_specific/flash_the_m5stack_core_basic
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
24 changes: 11 additions & 13 deletions device_specific/flash_the_m5stack_fire
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
24 changes: 11 additions & 13 deletions device_specific/flash_the_m5stack_m5stickc_plus
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
24 changes: 11 additions & 13 deletions device_specific/flash_the_ttgo_tdisplay
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
24 changes: 11 additions & 13 deletions flash_your_device
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down

0 comments on commit efd65f3

Please sign in to comment.