meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.37k stars 824 forks source link

dev-install.sh fails when there is a space in the path of python #1087

Closed mkinney closed 2 years ago

mkinney commented 2 years ago

Describe the bug If there is a space in the path of python, then the device-install.sh fails at line 49.

To Reproduce Steps to reproduce the behavior:

  1. Create a directory with a space in it. "cd /tmp; mkdir a\ b; cd a\ b;"
  2. Create python virtual environment. "python3 -m venv venv; source venv/bin/activate; pip install esptool"
  3. Change into where the firmware.zip has been unzipped.
  4. Run: "./device-install.sh "

Expected behavior Firmware should update.

Screenshots

% ./device-install.sh -f firmware-heltec-v2.1-1.2.51.f9ff06b.bin
Trying to flash firmware-heltec-v2.1-1.2.51.f9ff06b.bin, but first erasing and writing system information
./device-install.sh: line 49: /Users/xxx/ham/meshtastic: is a directory

Device info:

Additional context I was able to continue by surrounding the last lines with double quotes:

    "$PYTHON" -m esptool  erase_flash
    "$PYTHON" -m esptool  write_flash 0x1000 system-info.bin
    "$PYTHON" -m esptool  write_flash 0x00390000 spiffs-*.bin
    "$PYTHON" -m esptool  write_flash 0x10000 ${FILENAME}
mkinney commented 2 years ago

User ernax78 pointed out that maybe we should not be determining PYTHON this way:

PYTHON=${PYTHON:-$(which python3 python|head -n 1)}

Perhaps we should use env python3

And, perhaps we should check for esptool availability.