diff --git a/README.md b/README.md index af03866..93d1d56 100644 --- a/README.md +++ b/README.md @@ -120,29 +120,24 @@ After the script completes, you should see the Jade initialization screen on you 1. Open the Terminal. On Linux, press `Ctrl+Alt+T`. On macOS, press `Command+Space`, type terminal, and press `return`. -2. Clone (download) this repository and changie to the directory. Run the following in Terminal: - ```bash - git clone --quiet https://github.com/epiccurious/jade-diy "${HOME}"/jade-diy && cd "${HOME}"/jade-diy/ - ``` - -3. Connect your device to your computer via USB. +2. Connect your device to your computer via USB. -4. Run the device-specific script corresponding to the hardware you're using. This process can take up to 30 minutes on a slow computer. +3. Run one of the following in Terminal: - If you're using the TTGO T-Dispay, run: ``` - sudo device_specific/flash_the_ttgo_tdisplay + /bin/bash -c "$(curl -sSL https://github.com/epiccurious/jade-diy/raw/master/device_specific/flash_the_ttgo_tdisplay)" ``` - If you're using the M5Stack M5StickC PLUS, run: ``` - sudo device_specific/flash_the_m5stack_m5stickc_plus + /bin/bash -c "$(curl -sSL https://github.com/epiccurious/jade-diy/raw/master/device_specific/flash_the_m5stack_m5stickc_plus)" ``` - If you're using the M5Stack Core Basic, run: ``` - sudo device_specific/flash_the_m5stack_core_basic + /bin/bash -c "$(curl -sSL https://github.com/epiccurious/jade-diy/raw/master/device_specific/flash_the_m5stack_core_basic)" ``` - If you're using the M5Stack FIRE, run: ``` - sudo device_specific/flash_the_m5stack_fire + /bin/bash -c "$(curl -sSL https://github.com/epiccurious/jade-diy/raw/master/device_specific/flash_the_m5stack_fire)" ``` After the script completes, you should see the Jade initialization screen on your device. diff --git a/device_specific/flash_the_m5stack_core_basic b/device_specific/flash_the_m5stack_core_basic index 89585fd..f7dede3 100755 --- a/device_specific/flash_the_m5stack_core_basic +++ b/device_specific/flash_the_m5stack_core_basic @@ -1,48 +1,86 @@ #!/bin/bash set -e -if [ "$(whoami)" != root ]; then - echo -e "ERROR: Please run the script with elevated permissions like this:\n sudo ~/jade-diy/device_specific/flash_the_m5stack_core_basic.sh" - exit 1 -fi +working_directory="${HOME}/Downloads/diy_jade" +temp_directory="${working_directory}/temp" +trap 'rm -rf -- "${temp_directory}"' EXIT + +jade_git_tag="1.0.26" +jade_save_directory="${working_directory}/jade" +jade_repo_url="https://github.com/blockstream/jade.git" -esp_dir="${HOME}/esp" -esp_idf_git_dir="${esp_dir}/esp-idf" esp_idf_git_tag="v5.1.1" -jade_git_dir="${HOME}/jade" +esp_idf_temp_directory="${temp_directory}/esp-idf" +esp_idf_save_directory="${working_directory}/esp-idf" +esp_idf_repo_url="https://github.com/espressif/esp-idf.git" device="M5Stack Core Basic" +tty_device="/dev/ttyACM0" + +clear +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo "--- ---" +echo "--- Do-It-Yourself Jade Install Script ---" +echo "--- Written by Epic Curious ---" +echo "--- Twitter: @epic_curious ---" +echo "--- ---" +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo + +if [ "$(whoami)" = "root" ]; then + echo -e "ALERT: You're running the script as root/superuser.\nYou may notice PIP 'sudo -H' warnings.\n" +fi + echo "LINUX ONLY. Flashing the ${device}..." -#[ -f /var/lib/apt/lists/lock ] && echo "ERROR: `apt` is locked. Are you installing system updates?" && exit 1 -apt-get -qq update -apt-get -qq install -y -o=Dpkg::Use-Pty=0 cmake git python3-pip python3-venv &> /dev/null - -if [ ! -f "${esp_idf_git_dir}"/export.sh ]; then - [ -d "${esp_dir}" ] || mkdir "${esp_dir}" - git clone --quiet https://github.com/espressif/esp-idf.git "${esp_idf_git_dir}" - cd "${esp_idf_git_dir}"/ - git checkout --quiet "${esp_idf_git_tag}" - git submodule update --quiet --init --recursive - ./install.sh esp32 1>/dev/null +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 + +if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then + git --branch "${esp_idf_git_tag}" --single-branch --depth 1 --quiet "${esp_idf_repo_url}" "${esp_idf_temp_directory}" + cd "${esp_idf_git_dir}"/ + git submodule update --depth 1 --init --recursive --quiet + ./install.sh esp32 &>/dev/null + source ./export.sh 1>/dev/null + mv "${esp_idf_temp_directory}" "${esp_idf_save_directory}" fi -. "${esp_idf_git_dir}"/export.sh 1>/dev/null +./install.sh esp32 +source "${esp_idf_git_dir}"/export.sh -if [ ! -d "${jade_git_dir}" ]; then - git clone --quiet https://github.com/blockstream/jade.git "${jade_git_dir}" - cd "${jade_git_dir}" - git checkout --quiet "$(git tag | grep -v miner | sort -V | tail -1)" - git submodule update --quiet --init --recursive +if [ ! -d "${jade_save_directory}" ]; then + git clone --branch "${jade_git_tag}" --single-branch --depth 1 --quiet "${jade_repo_url}" "${jade_save_directory}" + cd "${jade_save_directory}" + git submodule update --depth 1 --init --recursive --quiet &> /dev/null fi -cd "${jade_git_dir}" +cd "${jade_save_directory}" cp configs/sdkconfig_display_m5blackgray.defaults sdkconfig.defaults sed -i.bak '/CONFIG_DEBUG_MODE/d' ./sdkconfig.defaults sed -i.bak '1s/^/CONFIG_LOG_DEFUALT_LEVEL_NONE=y\n/' sdkconfig.defaults rm sdkconfig.defaults.bak -chmod a+rw /dev/ttyACM0 +while [ ! -c "${tty_device}" ]; do + read -srn1 -p "Connect your ${device} and PRESS ANY KEY to continue... " && echo +done +tty_device_permissions="$(stat -c '%a' ${tty_device})" +if [ "${tty_device_permissions:2}" -lt 6 ]; then + echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" + exit 1 +fi + idf.py flash -opt="M5Stack Core Basic" -echo -e "\nSUCCESS! Your ${opt} is now running Jade." +echo -e "\nSUCCESS! Your ${device} is now running Jade." diff --git a/device_specific/flash_the_m5stack_fire b/device_specific/flash_the_m5stack_fire index 44e72dd..0a1c9bc 100755 --- a/device_specific/flash_the_m5stack_fire +++ b/device_specific/flash_the_m5stack_fire @@ -1,48 +1,86 @@ #!/bin/bash set -e -if [ "$(whoami)" != root ]; then - echo -e "ERROR: Please run the script with elevated permissions like this:\n sudo ~/jade-diy/device_specific/flash_the_m5stack_fire.sh" - exit 1 -fi +working_directory="${HOME}/Downloads/diy_jade" +temp_directory="${working_directory}/temp" +trap 'rm -rf -- "${temp_directory}"' EXIT + +jade_git_tag="1.0.26" +jade_save_directory="${working_directory}/jade" +jade_repo_url="https://github.com/blockstream/jade.git" -esp_dir="${HOME}/esp" -esp_idf_git_dir="${esp_dir}/esp-idf" esp_idf_git_tag="v5.1.1" -jade_git_dir="${HOME}/jade" +esp_idf_temp_directory="${temp_directory}/esp-idf" +esp_idf_save_directory="${working_directory}/esp-idf" +esp_idf_repo_url="https://github.com/espressif/esp-idf.git" device="M5Stack FIRE" +tty_device="/dev/ttyACM0" + +clear +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo "--- ---" +echo "--- Do-It-Yourself Jade Install Script ---" +echo "--- Written by Epic Curious ---" +echo "--- Twitter: @epic_curious ---" +echo "--- ---" +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo + +if [ "$(whoami)" = "root" ]; then + echo -e "ALERT: You're running the script as root/superuser.\nYou may notice PIP 'sudo -H' warnings.\n" +fi + echo "LINUX ONLY. Flashing the ${device}..." -#[ -f /var/lib/apt/lists/lock ] && echo "ERROR: `apt` is locked. Are you installing system updates?" && exit 1 -apt-get -qq update -apt-get -qq install -y -o=Dpkg::Use-Pty=0 cmake git python3-pip python3-venv &> /dev/null - -if [ ! -f "${esp_idf_git_dir}"/export.sh ]; then - [ -d "${esp_dir}" ] || mkdir "${esp_dir}" - git clone --quiet https://github.com/espressif/esp-idf.git "${esp_idf_git_dir}" - cd "${esp_idf_git_dir}"/ - git checkout --quiet "${esp_idf_git_tag}" - git submodule update --quiet --init --recursive - ./install.sh esp32 1>/dev/null +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 + +if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then + git --branch "${esp_idf_git_tag}" --single-branch --depth 1 --quiet "${esp_idf_repo_url}" "${esp_idf_temp_directory}" + cd "${esp_idf_git_dir}"/ + git submodule update --depth 1 --init --recursive --quiet + ./install.sh esp32 &>/dev/null + source ./export.sh 1>/dev/null + mv "${esp_idf_temp_directory}" "${esp_idf_save_directory}" fi -. "${esp_idf_git_dir}"/export.sh 1>/dev/null +./install.sh esp32 +source "${esp_idf_git_dir}"/export.sh -if [ ! -d "${jade_git_dir}" ]; then - git clone --quiet https://github.com/blockstream/jade.git "${jade_git_dir}" - cd "${jade_git_dir}" - git checkout --quiet "$(git tag | grep -v miner | sort -V | tail -1)" - git submodule update --quiet --init --recursive +if [ ! -d "${jade_save_directory}" ]; then + git clone --branch "${jade_git_tag}" --single-branch --depth 1 --quiet "${jade_repo_url}" "${jade_save_directory}" + cd "${jade_save_directory}" + git submodule update --depth 1 --init --recursive --quiet &> /dev/null fi -cd "${jade_git_dir}" +cd "${jade_save_directory}" cp configs/sdkconfig_display_m5fire.defaults sdkconfig.defaults sed -i.bak '/CONFIG_DEBUG_MODE/d' ./sdkconfig.defaults sed -i.bak '1s/^/CONFIG_LOG_DEFUALT_LEVEL_NONE=y\n/' sdkconfig.defaults rm sdkconfig.defaults.bak -chmod a+rw /dev/ttyACM0 +while [ ! -c "${tty_device}" ]; do + read -srn1 -p "Connect your ${device} and PRESS ANY KEY to continue... " && echo +done +tty_device_permissions="$(stat -c '%a' ${tty_device})" +if [ "${tty_device_permissions:2}" -lt 6 ]; then + echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" + exit 1 +fi + idf.py flash -opt="M5Stack FIRE" -echo -e "\nSUCCESS! Your ${opt} is now running Jade." +echo -e "\nSUCCESS! Your ${device} is now running Jade." diff --git a/device_specific/flash_the_m5stack_m5stickc_plus b/device_specific/flash_the_m5stack_m5stickc_plus index c27049d..ba33efa 100755 --- a/device_specific/flash_the_m5stack_m5stickc_plus +++ b/device_specific/flash_the_m5stack_m5stickc_plus @@ -1,48 +1,86 @@ #!/bin/bash set -e -if [ "$(whoami)" != root ]; then - echo -e "ERROR: Please run the script with elevated permissions like this:\n sudo ~/jade-diy/device_specific/flash_the_m5stack_m5stickc_plus.sh" - exit 1 -fi +working_directory="${HOME}/Downloads/diy_jade" +temp_directory="${working_directory}/temp" +trap 'rm -rf -- "${temp_directory}"' EXIT + +jade_git_tag="1.0.26" +jade_save_directory="${working_directory}/jade" +jade_repo_url="https://github.com/blockstream/jade.git" -esp_dir="${HOME}/esp" -esp_idf_git_dir="${esp_dir}/esp-idf" esp_idf_git_tag="v5.1.1" -jade_git_dir="${HOME}/jade" +esp_idf_temp_directory="${temp_directory}/esp-idf" +esp_idf_save_directory="${working_directory}/esp-idf" +esp_idf_repo_url="https://github.com/espressif/esp-idf.git" device="M5Stack M5StickC PLUS" +tty_device="/dev/ttyUSB0" + +clear +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo "--- ---" +echo "--- Do-It-Yourself Jade Install Script ---" +echo "--- Written by Epic Curious ---" +echo "--- Twitter: @epic_curious ---" +echo "--- ---" +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo + +if [ "$(whoami)" = "root" ]; then + echo -e "ALERT: You're running the script as root/superuser.\nYou may notice PIP 'sudo -H' warnings.\n" +fi + echo "LINUX ONLY. Flashing the ${device}..." -#[ -f /var/lib/apt/lists/lock ] && echo "ERROR: `apt` is locked. Are you installing system updates?" && exit 1 -apt-get -qq update -apt-get -qq install -y -o=Dpkg::Use-Pty=0 cmake git python3-pip python3-venv &> /dev/null - -if [ ! -f "${esp_idf_git_dir}"/export.sh ]; then - [ -d "${esp_dir}" ] || mkdir "${esp_dir}" - git clone --quiet https://github.com/espressif/esp-idf.git "${esp_idf_git_dir}" - cd "${esp_idf_git_dir}"/ - git checkout --quiet "${esp_idf_git_tag}" - git submodule update --quiet --init --recursive - ./install.sh esp32 1>/dev/null +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 + +if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then + git --branch "${esp_idf_git_tag}" --single-branch --depth 1 --quiet "${esp_idf_repo_url}" "${esp_idf_temp_directory}" + cd "${esp_idf_git_dir}"/ + git submodule update --depth 1 --init --recursive --quiet + ./install.sh esp32 &>/dev/null + source ./export.sh 1>/dev/null + mv "${esp_idf_temp_directory}" "${esp_idf_save_directory}" fi -. "${esp_idf_git_dir}"/export.sh 1>/dev/null +./install.sh esp32 +source "${esp_idf_git_dir}"/export.sh -if [ ! -d "${jade_git_dir}" ]; then - git clone --quiet https://github.com/blockstream/jade.git "${jade_git_dir}" - cd "${jade_git_dir}" - git checkout --quiet "$(git tag | grep -v miner | sort -V | tail -1)" - git submodule update --quiet --init --recursive +if [ ! -d "${jade_save_directory}" ]; then + git clone --branch "${jade_git_tag}" --single-branch --depth 1 --quiet "${jade_repo_url}" "${jade_save_directory}" + cd "${jade_save_directory}" + git submodule update --depth 1 --init --recursive --quiet &> /dev/null fi -cd "${jade_git_dir}" +cd "${jade_save_directory}" cp configs/sdkconfig_display_m5stickcplus.defaults sdkconfig.defaults sed -i.bak '/CONFIG_DEBUG_MODE/d' ./sdkconfig.defaults sed -i.bak '1s/^/CONFIG_LOG_DEFUALT_LEVEL_NONE=y\n/' sdkconfig.defaults rm sdkconfig.defaults.bak -chmod a+rw /dev/ttyUSB0 +while [ ! -c "${tty_device}" ]; do + read -srn1 -p "Connect your ${device} and PRESS ANY KEY to continue... " && echo +done +tty_device_permissions="$(stat -c '%a' ${tty_device})" +if [ "${tty_device_permissions:2}" -lt 6 ]; then + echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" + exit 1 +fi + idf.py -b 115200 flash -opt="M5Stack M5StickC PLUS" -echo -e "\nSUCCESS! Your ${opt} is now running Jade." +echo -e "\nSUCCESS! Your ${device} is now running Jade." diff --git a/device_specific/flash_the_ttgo_tdisplay b/device_specific/flash_the_ttgo_tdisplay index 55dad1a..37117a4 100755 --- a/device_specific/flash_the_ttgo_tdisplay +++ b/device_specific/flash_the_ttgo_tdisplay @@ -1,48 +1,86 @@ #!/bin/bash set -e -if [ "$(whoami)" != root ]; then - echo -e "ERROR: Please run the script with elevated permissions like this:\n sudo ~/jade-diy/device_specific/flash_the_ttgo_tdisplay.sh" - exit 1 -fi +working_directory="${HOME}/Downloads/diy_jade" +temp_directory="${working_directory}/temp" +trap 'rm -rf -- "${temp_directory}"' EXIT + +jade_git_tag="1.0.26" +jade_save_directory="${working_directory}/jade" +jade_repo_url="https://github.com/blockstream/jade.git" -esp_dir="${HOME}/esp" -esp_idf_git_dir="${esp_dir}/esp-idf" esp_idf_git_tag="v5.1.1" -jade_git_dir="${HOME}/jade" +esp_idf_temp_directory="${temp_directory}/esp-idf" +esp_idf_save_directory="${working_directory}/esp-idf" +esp_idf_repo_url="https://github.com/espressif/esp-idf.git" device="TTGO T-Display" +tty_device="/dev/ttyACM0" + +clear +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo "--- ---" +echo "--- Do-It-Yourself Jade Install Script ---" +echo "--- Written by Epic Curious ---" +echo "--- Twitter: @epic_curious ---" +echo "--- ---" +echo "------------------------------------------------------------" +echo "------------------------------------------------------------" +echo + +if [ "$(whoami)" = "root" ]; then + echo -e "ALERT: You're running the script as root/superuser.\nYou may notice PIP 'sudo -H' warnings.\n" +fi + echo "LINUX ONLY. Flashing the ${device}..." -#[ -f /var/lib/apt/lists/lock ] && echo "ERROR: `apt` is locked. Are you installing system updates?" && exit 1 -apt-get -qq update -apt-get -qq install -y -o=Dpkg::Use-Pty=0 cmake git python3-pip python3-venv &> /dev/null - -if [ ! -f "${esp_idf_git_dir}"/export.sh ]; then - [ -d "${esp_dir}" ] || mkdir "${esp_dir}" - git clone --quiet https://github.com/espressif/esp-idf.git "${esp_idf_git_dir}" - cd "${esp_idf_git_dir}"/ - git checkout --quiet "${esp_idf_git_tag}" - git submodule update --quiet --init --recursive - ./install.sh esp32 1>/dev/null +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 + +if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then + git --branch "${esp_idf_git_tag}" --single-branch --depth 1 --quiet "${esp_idf_repo_url}" "${esp_idf_temp_directory}" + cd "${esp_idf_git_dir}"/ + git submodule update --depth 1 --init --recursive --quiet + ./install.sh esp32 &>/dev/null + source ./export.sh 1>/dev/null + mv "${esp_idf_temp_directory}" "${esp_idf_save_directory}" fi -. "${esp_idf_git_dir}"/export.sh 1>/dev/null +./install.sh esp32 +source "${esp_idf_git_dir}"/export.sh -if [ ! -d "${jade_git_dir}" ]; then - git clone --quiet https://github.com/blockstream/jade.git "${jade_git_dir}" - cd "${jade_git_dir}" - git checkout --quiet "$(git tag | grep -v miner | sort -V | tail -1)" - git submodule update --quiet --init --recursive +if [ ! -d "${jade_save_directory}" ]; then + git clone --branch "${jade_git_tag}" --single-branch --depth 1 --quiet "${jade_repo_url}" "${jade_save_directory}" + cd "${jade_save_directory}" + git submodule update --depth 1 --init --recursive --quiet &> /dev/null fi -cd "${jade_git_dir}" +cd "${jade_save_directory}" cp configs/sdkconfig_display_ttgo_tdisplay.defaults sdkconfig.defaults sed -i.bak '/CONFIG_DEBUG_MODE/d' ./sdkconfig.defaults sed -i.bak '1s/^/CONFIG_LOG_DEFUALT_LEVEL_NONE=y\n/' sdkconfig.defaults rm sdkconfig.defaults.bak -chmod a+rw /dev/ttyACM0 +while [ ! -c "${tty_device}" ]; do + read -srn1 -p "Connect your ${device} and PRESS ANY KEY to continue... " && echo +done +tty_device_permissions="$(stat -c '%a' ${tty_device})" +if [ "${tty_device_permissions:2}" -lt 6 ]; then + echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" + exit 1 +fi + idf.py flash -opt="TTGO T-Display" -echo -e "\nSUCCESS! Your ${opt} is now running Jade." +echo -e "\nSUCCESS! Your ${device} is now running Jade." diff --git a/flash_your_device b/flash_your_device index 6fbd8ad..53dfdf9 100755 --- a/flash_your_device +++ b/flash_your_device @@ -109,7 +109,7 @@ if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then echo -ne "\n Downloading the framework... " git -c advice.detachedHead=false clone --branch "${esp_idf_git_tag}" --single-branch --depth 1 --quiet "${esp_idf_repo_url}" "${esp_idf_temp_directory}" cd "${esp_idf_temp_directory}"/ - git submodule update --depth 1 --quiet --init --recursive &> /dev/null + git submodule update --depth 1 --init --recursive --quiet &> /dev/null ./install.sh esp32 &>/dev/null # shellcheck source=/dev/null source ./export.sh 1>/dev/null @@ -127,11 +127,11 @@ source ./export.sh 1>/dev/null echo "ok." echo -n "Checking for the Blockstream Jade repository... " -if [ ! -d "${working_directory}"/jade ]; then +if [ ! -d "${jade_save_directory}" ]; then echo -ne "\n Downloading Jade... " git -c advice.detachedHead=false clone --branch "${jade_git_tag}" --single-branch --depth 1 --quiet "${jade_repo_url}" "${jade_save_directory}" cd "${jade_save_directory}" - git submodule update --depth 1 --quiet --init --recursive &> /dev/null + git submodule update --depth 1 --init --recursive --quiet &> /dev/null fi cd "${jade_save_directory}" jade_version="$(git describe --tags)" @@ -186,7 +186,7 @@ case "${machine}" in while [ ! -c "${tty_device}" ]; do read -srn1 -p "Connect your ${chosen_device} and PRESS ANY KEY to continue... " && echo done - tty_device_permissions="$(stat -c '%a' /dev/ttyACM0)" + tty_device_permissions="$(stat -c '%a' ${tty_device})" if [ "${tty_device_permissions:2}" -lt 6 ]; then echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" exit 1