mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-01 11:25:44 +00:00
Fixed --change-mode option since it was broken (#7144)
getopts can't parse double-dash options so it had to be done separately. Also fixed where CHANGE_MODE was checked since it wasn't working either.
This commit is contained in:
parent
f13dc5b903
commit
ff4eed08bc
@ -30,6 +30,18 @@ Flash image file to device, leave existing system intact."
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check for --change-mode and remove it from arguments
|
||||||
|
NEW_ARGS=""
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ "$arg" = "--change-mode" ]; then
|
||||||
|
CHANGE_MODE=true
|
||||||
|
else
|
||||||
|
NEW_ARGS="$NEW_ARGS \"\$arg\""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Reset positional parameters to filtered list
|
||||||
|
eval set -- $NEW_ARGS
|
||||||
|
|
||||||
while getopts ":hp:P:f:" opt; do
|
while getopts ":hp:P:f:" opt; do
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
@ -43,9 +55,6 @@ while getopts ":hp:P:f:" opt; do
|
|||||||
;;
|
;;
|
||||||
f) FILENAME=${OPTARG}
|
f) FILENAME=${OPTARG}
|
||||||
;;
|
;;
|
||||||
--change-mode)
|
|
||||||
CHANGE_MODE=true
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Invalid flag."
|
echo "Invalid flag."
|
||||||
show_help >&2
|
show_help >&2
|
||||||
@ -55,7 +64,7 @@ while getopts ":hp:P:f:" opt; do
|
|||||||
done
|
done
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
if [[ $CHANGE_MODE == true ]]; then
|
if [ "$CHANGE_MODE" = true ]; then
|
||||||
$ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status
|
$ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user