diff --git a/scripts/fluidd.sh b/scripts/fluidd.sh index 4ae6232..8573641 100644 --- a/scripts/fluidd.sh +++ b/scripts/fluidd.sh @@ -171,49 +171,64 @@ function fluidd_status(){ fi } -function read_local_fluidd_version(){ - unset FLUIDD_VER_FOUND - if [ -e "${FLUIDD_DIR}/.version" ]; then - FLUIDD_VER_FOUND="true" - FLUIDD_LOCAL_VER=$(head -n 1 "${FLUIDD_DIR}/.version") - else - FLUIDD_VER_FOUND="false" && unset FLUIDD_LOCAL_VER - fi +function get_local_fluidd_version(){ + local version + [ ! -f "${FLUIDD_DIR}/.version" ] && return + version=$(head -n 1 "${FLUIDD_DIR}/.version") + echo "${version}" } -function read_remote_fluidd_version(){ - #remote checks don't work without curl installed! - if [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]]; then - FLUIDD_REMOTE_VER=${NONE} - else - get_fluidd_ver - FLUIDD_REMOTE_VER=${FLUIDD_VERSION} - fi +function get_remote_fluidd_version(){ + local version + [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return + version=$(get_fluidd_download_url | rev | cut -d"/" -f2 | rev) + echo "${version}" } function compare_fluidd_versions(){ unset FLUIDD_UPDATE_AVAIL - read_local_fluidd_version && read_remote_fluidd_version - if [[ $FLUIDD_VER_FOUND = "true" ]] && [[ $FLUIDD_LOCAL_VER == $FLUIDD_REMOTE_VER ]]; then - #printf fits the string for displaying it in the ui to a total char length of 12 - FLUIDD_LOCAL_VER="${green}$(printf "%-12s" "$FLUIDD_LOCAL_VER")${default}" - FLUIDD_REMOTE_VER="${green}$(printf "%-12s" "$FLUIDD_REMOTE_VER")${default}" - elif [[ $FLUIDD_VER_FOUND = "true" ]] && [[ $FLUIDD_LOCAL_VER != $FLUIDD_REMOTE_VER ]]; then - FLUIDD_LOCAL_VER="${yellow}$(printf "%-12s" "$FLUIDD_LOCAL_VER")${default}" - FLUIDD_REMOTE_VER="${green}$(printf "%-12s" "$FLUIDD_REMOTE_VER")${default}" + local versions local_ver remote_ver + local_ver="$(get_local_fluidd_version)" + remote_ver="$(get_remote_fluidd_version)" + if [ "${local_ver}" != "${remote_ver}" ]; then + versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" # add fluidd to the update all array for the update all function in the updater FLUIDD_UPDATE_AVAIL="true" && update_arr+=(update_fluidd) else - FLUIDD_LOCAL_VER=$NONE - FLUIDD_REMOTE_VER="${green}$(printf "%-12s" "$FLUIDD_REMOTE_VER")${default}" + versions="${green}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" FLUIDD_UPDATE_AVAIL="false" fi + echo "${versions}" } #================================================# #=================== HELPERS ====================# #================================================# +function get_fluidd_download_url() { + local latest_tag latest_url stable_tag stable_url url + tags=$(curl -s "${FLUIDD_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" + + read_kiauh_ini + if [ "${fluidd_install_unstable}" == "true" ]; then + url="${latest_url}" + echo "${url}" + else + url="${stable_url}" + echo "${url}" + fi +} + function fluidd_port_check(){ if [ "${FLUIDD_ENABLED}" = "false" ]; then if [ "${SITE_ENABLED}" = "true" ]; then diff --git a/scripts/globals.sh b/scripts/globals.sh index 4284dc7..c551812 100644 --- a/scripts/globals.sh +++ b/scripts/globals.sh @@ -46,6 +46,7 @@ function set_globals(){ #================== FLUIDD ====================# FLUIDD_DIR="${HOME}/fluidd" FLUIDD_REPO_API="https://api.github.com/repos/fluidd-core/fluidd/releases" + FLUIDD_TAGS="https://api.github.com/repos/fluidd-core/fluidd/tags" #=============== KLIPPERSCREEN ================# KLIPPERSCREEN_ENV_DIR="${HOME}/.KlipperScreen-env" @@ -61,6 +62,6 @@ function set_globals(){ NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git #=============== PRETTY-GCODE =================# - PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode" PGC_DIR="${HOME}/pgcode" + PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode" } \ No newline at end of file diff --git a/scripts/klipper.sh b/scripts/klipper.sh index 453dd05..3e7253f 100644 --- a/scripts/klipper.sh +++ b/scripts/klipper.sh @@ -358,6 +358,7 @@ function get_klipper_status(){ } function get_local_klipper_commit(){ + local commit [ ! -d "${KLIPPER_DIR}" ] || [ ! -d "${KLIPPER_DIR}"/.git ] && return cd "${KLIPPER_DIR}" commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" @@ -365,6 +366,7 @@ function get_local_klipper_commit(){ } function get_remote_klipper_commit(){ + local commit [ ! -d "${KLIPPER_DIR}" ] || [ ! -d "${KLIPPER_DIR}"/.git ] && return cd "${KLIPPER_DIR}" && git fetch origin -q commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) diff --git a/scripts/klipperscreen.sh b/scripts/klipperscreen.sh index 9c3d9cf..5f24b94 100644 --- a/scripts/klipperscreen.sh +++ b/scripts/klipperscreen.sh @@ -154,29 +154,36 @@ function klipperscreen_status(){ fi } -function read_klipperscreen_versions(){ - if [ -d "${KLIPPERSCREEN_DIR}" ] && [ -d "${KLIPPERSCREEN_DIR}/.git" ]; then - cd "${KLIPPERSCREEN_DIR}" - git fetch origin master -q - LOCAL_KLIPPERSCREEN_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2) - REMOTE_KLIPPERSCREEN_COMMIT=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - else - LOCAL_KLIPPERSCREEN_COMMIT="${NONE}" - REMOTE_KLIPPERSCREEN_COMMIT="${NONE}" - fi +function get_local_klipperscreen_commit(){ + local commit + [ ! -d "${KLIPPERSCREEN_DIR}" ] || [ ! -d "${KLIPPERSCREEN_DIR}"/.git ] && return + cd "${KLIPPERSCREEN_DIR}" + commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" + echo "${commit}" +} + +function get_remote_klipperscreen_commit(){ + local commit + [ ! -d "${KLIPPERSCREEN_DIR}" ] || [ ! -d "${KLIPPERSCREEN_DIR}"/.git ] && return + cd "${KLIPPERSCREEN_DIR}" && git fetch origin -q + commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) + echo "${commit}" } function compare_klipperscreen_versions(){ unset KLIPPERSCREEN_UPDATE_AVAIL - read_klipperscreen_versions - if [ "${LOCAL_KLIPPERSCREEN_COMMIT}" != "${REMOTE_KLIPPERSCREEN_COMMIT}" ]; then - LOCAL_KLIPPERSCREEN_COMMIT="${yellow}$(printf "%-12s" "${LOCAL_KLIPPERSCREEN_COMMIT}")${white}" - REMOTE_KLIPPERSCREEN_COMMIT="${green}$(printf "%-12s" "${REMOTE_KLIPPERSCREEN_COMMIT}")${white}" - KLIPPERSCREEN_UPDATE_AVAIL="true" - update_arr+=(update_klipperscreen) + local versions local_ver remote_ver + local_ver="$(get_local_klipperscreen_commit)" + remote_ver="$(get_remote_klipperscreen_commit)" + if [ "${local_ver}" != "${remote_ver}" ]; then + versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" + # add klipperscreen to the update all array for the update all function in the updater + KLIPPERSCREEN_UPDATE_AVAIL="true" && update_arr+=(update_klipperscreen) else - LOCAL_KLIPPERSCREEN_COMMIT="${green}$(printf "%-12s" "${LOCAL_KLIPPERSCREEN_COMMIT}")${white}" - REMOTE_KLIPPERSCREEN_COMMIT="${green}$(printf "%-12s" "${REMOTE_KLIPPERSCREEN_COMMIT}")${white}" + versions="${green}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" KLIPPERSCREEN_UPDATE_AVAIL="false" fi + echo "${versions}" } diff --git a/scripts/mainsail.sh b/scripts/mainsail.sh index eec7fd5..8dd2130 100644 --- a/scripts/mainsail.sh +++ b/scripts/mainsail.sh @@ -238,43 +238,36 @@ function mainsail_status(){ fi } -function read_local_mainsail_version(){ - unset MAINSAIL_VER_FOUND - if [ -e "${MAINSAIL_DIR}/.version" ]; then - MAINSAIL_VER_FOUND="true" - MAINSAIL_LOCAL_VER=$(head -n 1 "${MAINSAIL_DIR}/.version") - else - MAINSAIL_VER_FOUND="false" && unset MAINSAIL_LOCAL_VER - fi +function get_local_mainsail_version(){ + local version + [ ! -f "${MAINSAIL_DIR}/.version" ] && return + version=$(head -n 1 "${MAINSAIL_DIR}/.version") + echo "${version}" } -function read_remote_mainsail_version(){ - #remote checks don't work without curl installed! - if [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]]; then - MAINSAIL_REMOTE_VER=${NONE} - else - get_mainsail_ver - MAINSAIL_REMOTE_VER=${MAINSAIL_VERSION} - fi +function get_remote_mainsail_version(){ + local version + [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return + version=$(get_mainsail_download_url | rev | cut -d"/" -f2 | rev) + echo "${version}" } function compare_mainsail_versions(){ unset MAINSAIL_UPDATE_AVAIL - read_local_mainsail_version && read_remote_mainsail_version - if [ "${MAINSAIL_VER_FOUND}" = "true" ] && [ "${MAINSAIL_LOCAL_VER}" == "${MAINSAIL_REMOTE_VER}" ]; then - #printf fits the string for displaying it in the ui to a total char length of 12 - MAINSAIL_LOCAL_VER="${green}$(printf "%-12s" "${MAINSAIL_LOCAL_VER}")${white}" - MAINSAIL_REMOTE_VER="${green}$(printf "%-12s" "${MAINSAIL_REMOTE_VER}")${white}" - elif [ "${MAINSAIL_VER_FOUND}" = "true" ] && [ "${MAINSAIL_LOCAL_VER}" != "${MAINSAIL_REMOTE_VER}" ]; then - MAINSAIL_LOCAL_VER="${yellow}$(printf "%-12s" "${MAINSAIL_LOCAL_VER}")${white}" - MAINSAIL_REMOTE_VER="${green}$(printf "%-12s" "${MAINSAIL_REMOTE_VER}")${white}" + local versions local_ver remote_ver + local_ver="$(get_local_mainsail_version)" + remote_ver="$(get_remote_mainsail_version)" + if [ "${local_ver}" != "${remote_ver}" ]; then + versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" # add mainsail to the update all array for the update all function in the updater MAINSAIL_UPDATE_AVAIL="true" && update_arr+=(update_mainsail) else - MAINSAIL_LOCAL_VER=${NONE} - MAINSAIL_REMOTE_VER="${green}$(printf "%-12s" "${MAINSAIL_REMOTE_VER}")${white}" + versions="${green}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" MAINSAIL_UPDATE_AVAIL="false" fi + echo "${versions}" } #================================================# diff --git a/scripts/moonraker-telegram-bot.sh b/scripts/moonraker-telegram-bot.sh index 8ffca16..20d02e3 100644 --- a/scripts/moonraker-telegram-bot.sh +++ b/scripts/moonraker-telegram-bot.sh @@ -130,29 +130,36 @@ function MoonrakerTelegramBot_status(){ fi } -function read_MoonrakerTelegramBot_versions(){ - if [ -d "${MOONRAKER_TELEGRAM_BOT_DIR}" ] && [ -d "${MOONRAKER_TELEGRAM_BOT_DIR}/.git" ]; then - cd "${MOONRAKER_TELEGRAM_BOT_DIR}" - git fetch origin master -q - LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2) - REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - else - LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT="${NONE}" - REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT="${NONE}" - fi +function get_local_telegram_bot_commit(){ + local commit + [ ! -d "${MOONRAKER_TELEGRAM_BOT_DIR}" ] || [ ! -d "${MOONRAKER_TELEGRAM_BOT_DIR}"/.git ] && return + cd "${MOONRAKER_TELEGRAM_BOT_DIR}" + commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" + echo "${commit}" } -function compare_MoonrakerTelegramBot_versions(){ +function get_remote_telegram_bot_commit(){ + local commit + [ ! -d "${MOONRAKER_TELEGRAM_BOT_DIR}" ] || [ ! -d "${MOONRAKER_TELEGRAM_BOT_DIR}"/.git ] && return + cd "${MOONRAKER_TELEGRAM_BOT_DIR}" && git fetch origin -q + commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) + echo "${commit}" +} + +function compare_prettygcode_versions(){ unset MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL - read_MoonrakerTelegramBot_versions - if [ "${LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT}" != "${REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT}" ]; then - LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT="${yellow}$(printf "%-12s" "${LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT}")${white}" - REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT="${green}$(printf "%-12s" "${REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT}")${white}" - # add moonraker telegram bot to the update all array for the update all function in the updater + local versions local_ver remote_ver + local_ver="$(get_local_telegram_bot_commit)" + remote_ver="$(get_remote_telegram_bot_commit)" + if [ "${local_ver}" != "${remote_ver}" ]; then + versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" + # add moonraker-telegram-bot to the update all array for the update all function in the updater MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL="true" && update_arr+=(update_MoonrakerTelegramBot) else - LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT="${green}$(printf "%-12s" "${LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT}")${white}" - REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT="${green}$(printf "%-12s" "${REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT}")${white}" + versions="${green}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL="false" fi + echo "${versions}" } diff --git a/scripts/moonraker.sh b/scripts/moonraker.sh index d7a6fcc..27c6362 100644 --- a/scripts/moonraker.sh +++ b/scripts/moonraker.sh @@ -452,23 +452,18 @@ function get_moonraker_status(){ } function get_local_moonraker_commit(){ - if [ -d "${MOONRAKER_DIR}" ] && [ -d "${MOONRAKER_DIR}"/.git ]; then - cd "${MOONRAKER_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - else - commit="${NONE}" - fi + local commit + [ ! -d "${MOONRAKER_DIR}" ] || [ ! -d "${MOONRAKER_DIR}"/.git ] && return + cd "${MOONRAKER_DIR}" + commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" echo "${commit}" } function get_remote_moonraker_commit(){ - if [ -d "${MOONRAKER_DIR}" ] && [ -d "${MOONRAKER_DIR}"/.git ]; then - cd "${MOONRAKER_DIR}" - git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - else - commit="${NONE}" - fi + local commit + [ ! -d "${MOONRAKER_DIR}" ] || [ ! -d "${MOONRAKER_DIR}"/.git ] && return + cd "${MOONRAKER_DIR}" && git fetch origin -q + commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) echo "${commit}" } @@ -480,7 +475,7 @@ function compare_moonraker_versions(){ if [ "${local_ver}" != "${remote_ver}" ]; then versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add klipper to the update all array for the update all function in the updater + # add moonraker to the update all array for the update all function in the updater MOONRAKER_UPDATE_AVAIL="true" && update_arr+=(update_moonraker) else versions="${green}$(printf " %-14s" "${local_ver}")${white}" diff --git a/scripts/pretty_gcode.sh b/scripts/pretty_gcode.sh index 8ca1b53..341fb55 100644 --- a/scripts/pretty_gcode.sh +++ b/scripts/pretty_gcode.sh @@ -83,30 +83,36 @@ function update_pgc_for_klipper(){ #=================== PGC STATUS ==================# #=================================================# -function read_pgc_versions(){ - PGC_DIR="${HOME}/pgcode" - if [ -d "${PGC_DIR}" ] && [ -d "${PGC_DIR}/.git" ]; then - cd "${PGC_DIR}" - git fetch origin main -q - LOCAL_PGC_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2) - REMOTE_PGC_COMMIT=$(git describe origin/main --always --tags | cut -d "-" -f 1,2) - else - LOCAL_PGC_COMMIT=${NONE} - REMOTE_PGC_COMMIT=${NONE} - fi +function get_local_prettygcode_commit(){ + local commit + [ ! -d "${PGC_DIR}" ] || [ ! -d "${PGC_DIR}"/.git ] && return + cd "${PGC_DIR}" + commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" + echo "${commit}" } -function compare_pgc_versions(){ +function get_remote_prettygcode_commit(){ + local commit + [ ! -d "${PGC_DIR}" ] || [ ! -d "${PGC_DIR}"/.git ] && return + cd "${PGC_DIR}" && git fetch origin -q + commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) + echo "${commit}" +} + +function compare_prettygcode_versions(){ unset PGC_UPDATE_AVAIL - read_pgc_versions - if [ "${LOCAL_PGC_COMMIT}" != "${REMOTE_PGC_COMMIT}" ]; then - LOCAL_PGC_COMMIT="${yellow}$(printf "%-12s" "${LOCAL_PGC_COMMIT}")${white}" - REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "${REMOTE_PGC_COMMIT}")${white}" - # add PGC to the update all array for the update all function in the updater + local versions local_ver remote_ver + local_ver="$(get_local_prettygcode_commit)" + remote_ver="$(get_remote_prettygcode_commit)" + if [ "${local_ver}" != "${remote_ver}" ]; then + versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" + # add prettygcode to the update all array for the update all function in the updater PGC_UPDATE_AVAIL="true" && update_arr+=(update_pgc_for_klipper) else - LOCAL_PGC_COMMIT="${green}$(printf "%-12s" "${LOCAL_PGC_COMMIT}")${white}" - REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "${REMOTE_PGC_COMMIT}")${white}" + versions="${green}$(printf " %-14s" "${local_ver}")${white}" + versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" PGC_UPDATE_AVAIL="false" fi + echo "${versions}" } \ No newline at end of file diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index c18ec4e..48cc8b2 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -20,20 +20,20 @@ update_ui(){ hr echo -e "| a) [Update all] | | | " echo -e "| | Installed: | Latest: | " - echo -e "| Klipper & API : |---------------|--------------| " + echo -e "| Klipper & API: |---------------|--------------| " echo -e "| 1) [Klipper] |$(compare_klipper_versions)| " echo -e "| 2) [Moonraker] |$(compare_moonraker_versions)| " echo -e "| | | | " echo -e "| Webinterface: |---------------|--------------| " - echo -e "| 3) [Mainsail] | $MAINSAIL_LOCAL_VER | $MAINSAIL_REMOTE_VER | " - echo -e "| 4) [Fluidd] | $FLUIDD_LOCAL_VER | $FLUIDD_REMOTE_VER | " + echo -e "| 3) [Mainsail] |$(compare_mainsail_versions)| " + echo -e "| 4) [Fluidd] |$(compare_fluidd_versions)| " echo -e "| | | | " echo -e "| Touchscreen GUI: |---------------|--------------| " - echo -e "| 5) [KlipperScreen] | $LOCAL_KLIPPERSCREEN_COMMIT | $REMOTE_KLIPPERSCREEN_COMMIT | " + echo -e "| 5) [KlipperScreen] |$(compare_klipperscreen_versions)| " echo -e "| | | | " echo -e "| Other: |---------------|--------------| " - echo -e "| 6) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | " - echo -e "| 7) [Telegram Bot] | $LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT | $REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT | " + echo -e "| 6) [PrettyGCode] |$(compare_prettygcode_versions)| " + echo -e "| 7) [Telegram Bot] |$(compare_prettygcode_versions)| " echo -e "| |------------------------------| " echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | " back_footer @@ -73,3 +73,56 @@ update_menu(){ done update_menu } + +function update_all(){ + while true; do + if [ "${#update_arr[@]}" = "0" ]; then + CONFIRM_MSG="Everything is already up to date!" + echo; break + fi + echo + top_border + echo -e "| The following installations will be updated: |" + if [ "$KLIPPER_UPDATE_AVAIL" = "true" ]; then + echo -e "| ${cyan}● Klipper${white} |" + fi + if [ "${MOONRAKER_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● Moonraker${white} |" + fi + if [ "${MAINSAIL_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● Mainsail${white} |" + fi + if [ "${FLUIDD_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● Fluidd${white} |" + fi + if [ "${KLIPPERSCREEN_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● KlipperScreen${white} |" + fi + if [ "${PGC_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● PrettyGCode for Klipper${white} |" + fi + if [ "${MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● MoonrakerTelegramBot${white} |" + fi + if [ "${SYS_UPDATE_AVAIL}" = "true" ]; then + echo -e "| ${cyan}● System${white} |" + fi + bottom_border + if [ "${#update_arr[@]}" != "0" ]; then + read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn + case "$yn" in + Y|y|Yes|yes|"") + for update in "${update_arr[@]}" + do + $update + done + break;; + N|n|No|no) + break;; + *) + print_unkown_cmd + print_msg && clear_msg;; + esac + fi + done +} diff --git a/scripts/update.sh b/scripts/update.sh index 21111fd..a522cba 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,56 +1,3 @@ -update_all(){ - while true; do - if [ "${#update_arr[@]}" = "0" ]; then - CONFIRM_MSG="Everything is already up to date!" - echo; break - fi - echo - top_border - echo -e "| The following installations will be updated: |" - if [ "$KLIPPER_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● Klipper${white} |" - fi - if [ "$MOONRAKER_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● Moonraker${white} |" - fi - if [ "$MAINSAIL_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● Mainsail${white} |" - fi - if [ "$FLUIDD_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● Fluidd${white} |" - fi - if [ "$KLIPPERSCREEN_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● KlipperScreen${white} |" - fi - if [ "$PGC_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● PrettyGCode for Klipper${white} |" - fi - if [ "$MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● MoonrakerTelegramBot${white} |" - fi - if [ "$SYS_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● System${white} |" - fi - bottom_border - if [ "${#update_arr[@]}" != "0" ]; then - read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn - case "$yn" in - Y|y|Yes|yes|"") - for update in ${update_arr[@]} - do - $update - done - break;; - N|n|No|no) - break;; - *) - print_unkown_cmd - print_msg && clear_msg;; - esac - fi - done -} - update_log_paths(){ ### update services to make use of moonrakers new log_path option ### https://github.com/Arksine/moonraker/commit/829b3a4ee80579af35dd64a37ccc092a1f67682a