diff --git a/11_write_factorytest_by_esptool.sh b/11_write_factorytest_by_esptool.sh index ecaf751..1177bed 100755 --- a/11_write_factorytest_by_esptool.sh +++ b/11_write_factorytest_by_esptool.sh @@ -6,10 +6,10 @@ BUILD_TOOL=$(lib_get_esptool_command) # BUILD_TOOLの文字列の長さが20以上の場合は、終了する if [ ${#BUILD_TOOL} -ge 20 ]; then + echo $BUILD_TOOL echo "===" - echo "esptool module is installed" echo "Please execute the script again." - echo "もう一度実行してください。" + echo "(上記のメッセージを確認したあと) もう一度実行してください。" echo "===" exit 1 fi @@ -50,7 +50,7 @@ echo "Main firmware: $FIRMWARE_PATH" # Upload the complete firmware using esptool.py -$BUILD_TOOL --chip esp32 --port "$PORT" --baud 460800 write_flash -z \ +$BUILD_TOOL --chip esp32 --port "$PORT" --baud 460800 write-flash -z \ 0x1000 "$BOOTLOADER_PATH" \ 0x8000 "$PARTITIONS_PATH" \ 0x10000 "$FIRMWARE_PATH" diff --git a/lib.sh b/lib.sh index 2d92e3b..7580ba1 100644 --- a/lib.sh +++ b/lib.sh @@ -2,23 +2,28 @@ # lib_get_esptool_command() { - WIN_PYTHON="py.exe" + WIN_PYTHON="python" if command -v esptool.py &> /dev/null then echo "esptool.py" else if ! command -v $WIN_PYTHON &> /dev/null then + $WIN_PYTHON + echo "エラー:Pythonコマンドを使用するため、まずPythonをインストールしてください。" + exit 1 + return echo "esptool.py nor $WIN_PYTHON could not be found. Please install it first." exit 1 else # check if esptool is installed as a module - if py.exe -m esptool --help &> /dev/null + if $WIN_PYTHON -m esptool --help &> /dev/null then echo "$WIN_PYTHON -m esptool" return else - bash -c "$WIN_PYTHON -m pip install esptool --no-warn-script-location" + $WIN_PYTHON -m pip install --upgrade pip + $WIN_PYTHON -m pip install esptool --no-warn-script-location return fi echo "$WIN_PYTHON -m esptool"