From c19acb1694e6957b0d4a8e5852c8db134a2bf6bd Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 4 Jun 2023 19:12:53 +0200 Subject: [PATCH 1/3] fix(mainsail/fluidd): fall back to latest stable url if fetching tags fails (#348) --- scripts/fluidd.sh | 33 +++++++++++++++++---------------- scripts/mainsail.sh | 33 +++++++++++++++++---------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/scripts/fluidd.sh b/scripts/fluidd.sh index 42fda1d..345a1c4 100644 --- a/scripts/fluidd.sh +++ b/scripts/fluidd.sh @@ -341,27 +341,28 @@ function compare_fluidd_versions() { #================================================# function get_fluidd_download_url() { - local fl_tags tags latest_tag latest_url stable_tag stable_url url + local releases_by_tag tags tag unstable_url url - fl_tags="https://api.github.com/repos/fluidd-core/fluidd/tags" - tags=$(curl -s "${fl_tags}" | grep "name" | cut -d'"' -f4) - - ### latest download url including pre-releases (alpha, beta, rc) - latest_tag=$(echo "${tags}" | head -1) - latest_url="https://github.com/fluidd-core/fluidd/releases/download/${latest_tag}/fluidd.zip" - - ### get stable fluidd download url - stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1) - stable_url="https://github.com/fluidd-core/fluidd/releases/download/${stable_tag}/fluidd.zip" + ### latest stable download url + url="https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip" read_kiauh_ini "${FUNCNAME[0]}" if [[ ${fluidd_install_unstable} == "true" ]]; then - url="${latest_url}" - echo "${url}" - else - url="${stable_url}" - echo "${url}" + releases_by_tag="https://api.github.com/repos/fluidd-core/fluidd/tags" + tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4) + tag=$(echo "${tags}" | head -1) + + ### latest unstable download url including pre-releases (alpha, beta, rc) + unstable_url="https://github.com/fluidd-core/fluidd/releases/download/${tag}/fluidd.zip" + + if [[ ${unstable_url} == *"download//"* ]]; then + warn_msg "Download URL broken! Falling back to URL of latest stable release!" + else + url=${unstable_url} + fi fi + + echo "${url}" } function fluidd_port_check() { diff --git a/scripts/mainsail.sh b/scripts/mainsail.sh index 0cdedfd..67fef87 100644 --- a/scripts/mainsail.sh +++ b/scripts/mainsail.sh @@ -511,27 +511,28 @@ function ms_theme_delete() { #================================================# function get_mainsail_download_url() { - local ms_tags tags latest_tag latest_url stable_tag stable_url url + local releases_by_tag tags tag unstable_url url - ms_tags="https://api.github.com/repos/mainsail-crew/mainsail/tags" - tags=$(curl -s "${ms_tags}" | grep "name" | cut -d'"' -f4) - - ### latest download url including pre-releases (alpha, beta, rc) - latest_tag=$(echo "${tags}" | head -1) - latest_url="https://github.com/mainsail-crew/mainsail/releases/download/${latest_tag}/mainsail.zip" - - ### get stable mainsail download url - stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1) - stable_url="https://github.com/mainsail-crew/mainsail/releases/download/${stable_tag}/mainsail.zip" + ### latest stable download url + url="https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip" read_kiauh_ini "${FUNCNAME[0]}" if [[ ${mainsail_install_unstable} == "true" ]]; then - url="${latest_url}" - echo "${url}" - else - url="${stable_url}" - echo "${url}" + releases_by_tag="https://api.github.com/repos/mainsail-crew/mainsail/tags" + tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4) + tag=$(echo "${tags}" | head -1) + + ### latest unstable download url including pre-releases (alpha, beta, rc) + unstable_url="https://github.com/mainsail-crew/mainsail/releases/download/${tag}/mainsail.zip" + + if [[ ${unstable_url} == *"download//"* ]]; then + warn_msg "Download URL broken! Falling back to URL of latest stable release!" + else + url=${unstable_url} + fi fi + + echo "${url}" } function mainsail_port_check() { -- 2.39.5 From 88a5451436b1853e52ec973d43d9239835fcf1b1 Mon Sep 17 00:00:00 2001 From: CODeRUS Date: Mon, 1 May 2023 13:54:51 +0300 Subject: [PATCH 2/3] feat: flash DFU device in HID mode --- scripts/flash_klipper.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/flash_klipper.sh b/scripts/flash_klipper.sh index 8ea0ab8..2444b7c 100644 --- a/scripts/flash_klipper.sh +++ b/scripts/flash_klipper.sh @@ -70,6 +70,7 @@ function select_mcu_connection() { echo -e "| How is the controller board connected to the host? |" echo -e "| 1) USB |" echo -e "| 2) UART |" + echo -e "| 3) DFU |" blank_line back_help_footer @@ -85,6 +86,10 @@ function select_mcu_connection() { status_msg "Identifying MCU possibly connected via UART ...\n" get_uart_id || true # continue even after exit code 1 break;; + 3) + status_msg "Identifying MCU connected via USB in DFU mode ...\n" + get_dfu_id || true # continue even after exit code 1 + break;; B|b) advanced_menu break;; @@ -329,6 +334,16 @@ function get_uart_id() { done } +function get_dfu_id() { + unset mcu_list + sleep 1 + mcus=$(lsusb | grep "DFU" | cut -d " " -f 6 2>/dev/null) + + for mcu in ${mcus}; do + mcu_list+=("${mcu}") + done +} + function show_flash_method_help() { top_border echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |" @@ -406,4 +421,4 @@ function show_mcu_connection_help() { error_msg "Invalid command!";; esac done -} \ No newline at end of file +} -- 2.39.5 From bf5e5a5523ee67b63473ff850da56718214f453c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 4 Jun 2023 21:22:53 +0200 Subject: [PATCH 3/3] style(klipper): fix wording Signed-off-by: Dominik Willner --- scripts/flash_klipper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/flash_klipper.sh b/scripts/flash_klipper.sh index 2444b7c..c281214 100644 --- a/scripts/flash_klipper.sh +++ b/scripts/flash_klipper.sh @@ -70,7 +70,7 @@ function select_mcu_connection() { echo -e "| How is the controller board connected to the host? |" echo -e "| 1) USB |" echo -e "| 2) UART |" - echo -e "| 3) DFU |" + echo -e "| 3) USB (DFU mode) |" blank_line back_help_footer -- 2.39.5