From ccf5b003fec5ed620a7d9033e08c9d603c12c877 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 9 Oct 2020 19:00:59 +0200 Subject: [PATCH 1/6] fix: more verbose ok_msg --- scripts/network_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/network_functions.sh b/scripts/network_functions.sh index 4d72664..8c6602b 100755 --- a/scripts/network_functions.sh +++ b/scripts/network_functions.sh @@ -25,7 +25,7 @@ set_nginx_cfg(){ if [ "$SET_LISTEN_PORT" != "" ]; then ok_msg "$1 listening on port $SET_LISTEN_PORT!" else - ok_msg "$1 listening on def-port $DEFAULT_PORT!" + ok_msg "$1 listening on default port $DEFAULT_PORT!" fi #remove nginx default config [ -e /etc/nginx/sites-enabled/default ] && sudo rm /etc/nginx/sites-enabled/default -- 2.39.5 From a4a85b1045e69f95c8e25f490e65850225992d40 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Oct 2020 01:22:08 +0200 Subject: [PATCH 2/6] func: drop support for switching to moonraker klipper branch (it's obsolete) --- kiauh.ini | 3 +-- kiauh.sh | 16 +++++++--------- scripts/functions.sh | 2 +- scripts/switch_branch.sh | 9 --------- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/kiauh.ini b/kiauh.ini index 71c376d..b23a238 100644 --- a/kiauh.ini +++ b/kiauh.ini @@ -3,5 +3,4 @@ backup_before_update=false previous_origin_state=0 previous_smoothing_state=0 previous_shaping_state=0 -previous_moonraker_state=0 -previous_dev_moonraker_state=0 \ No newline at end of file +logupload_accepted=false \ No newline at end of file diff --git a/kiauh.sh b/kiauh.sh index 194f157..b57d11b 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -2,14 +2,18 @@ clear set -e -### set some variables -ERROR_MSG="" +### set color variables green=$(echo -en "\e[92m") yellow=$(echo -en "\e[93m") red=$(echo -en "\e[91m") cyan=$(echo -en "\e[96m") default=$(echo -en "\e[97m") +### sourcing all additional scripts +SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" +for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done +for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done + ### set important directories #klipper KLIPPER_DIR=${HOME}/klipper @@ -39,7 +43,7 @@ OCTOPRINT_CFG_DIR=${HOME}/.octoprint OCTOPRINT_SERVICE1=/etc/init.d/octoprint OCTOPRINT_SERVICE2=/etc/default/octoprint #misc -INI_FILE=${HOME}/kiauh/kiauh.ini +INI_FILE=${SRCDIR}/kiauh/kiauh.ini BACKUP_DIR=${HOME}/kiauh-backups ### set github repos @@ -49,7 +53,6 @@ DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper-socket.git MOONRAKER_REPO=https://github.com/Arksine/moonraker.git #branches -BRANCH_MOONRAKER=Arksine/dev-moonraker-testing BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping @@ -95,11 +98,6 @@ clear_msg(){ unset ERROR_MSG } -### sourcing all additional scripts -SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" -for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done -for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done - check_euid kiauh_status main_menu \ No newline at end of file diff --git a/scripts/functions.sh b/scripts/functions.sh index c1bf84c..4beee9f 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -28,7 +28,7 @@ locate_printer_cfg(){ } source_ini(){ - source ${HOME}/kiauh/kiauh.ini + source ${SRCDIR}/kiauh/kiauh.ini } start_klipper(){ diff --git a/scripts/switch_branch.sh b/scripts/switch_branch.sh index 6838f8b..05284ff 100755 --- a/scripts/switch_branch.sh +++ b/scripts/switch_branch.sh @@ -20,13 +20,4 @@ switch_to_scurve_smoothing(){ git remote add dmbutyugin $DMBUTYUGIN_REPO fi git fetch dmbutyugin -q && git checkout $BRANCH_SCURVE_SMOOTHING -q -} - -switch_to_moonraker(){ - cd $KLIPPER_DIR - status_msg "Switching...Please wait ..."; echo - if ! git remote | grep Arksine -q; then - git remote add Arksine $ARKSINE_REPO - fi - git fetch Arksine -q && git checkout $BRANCH_MOONRAKER -q } \ No newline at end of file -- 2.39.5 From 4e2c6aa2cc9c15fd64452e5834a33900c293f2ce Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Oct 2020 09:35:40 +0200 Subject: [PATCH 3/6] fix: fluidd update function not existing --- scripts/ui/update_menu.sh | 6 ++++++ scripts/update.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index 629da4e..1df70bb 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -73,6 +73,12 @@ update_menu(){ update_mainsail && ui_print_versions print_msg && clear_msg update_ui;; + 6) + clear + print_header + update_fluidd && ui_print_versions + print_msg && clear_msg + update_ui;; a) clear print_header diff --git a/scripts/update.sh b/scripts/update.sh index c85e80f..69c892b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -98,6 +98,12 @@ update_mainsail(){ mainsail_setup } +update_fluidd(){ + bb4u "fluidd" + status_msg "Updating Fluidd ..." + fluidd_setup +} + update_moonraker(){ stop_klipper && sleep 2 && stop_moonraker bb4u "moonraker" -- 2.39.5 From 083ca8b7fd682c7197aed1cb06438a665746ae39 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Oct 2020 09:37:06 +0200 Subject: [PATCH 4/6] fix: fetching correct download url + more status messages --- scripts/install_fluidd.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/install_fluidd.sh b/scripts/install_fluidd.sh index 5df8e08..3f5e028 100755 --- a/scripts/install_fluidd.sh +++ b/scripts/install_fluidd.sh @@ -7,7 +7,7 @@ install_fluidd(){ fluidd_port_check #creating the fluidd nginx cfg set_nginx_cfg "fluidd" - fluidd_setup && ok_msg "Fluidd installation complete!"; echo + fluidd_setup fi } @@ -64,24 +64,26 @@ select_fluidd_port(){ } get_fluidd_ver(){ - FLUIDD_VERSION=$(curl -s https://api.github.com/repositories/295836951/tags | grep name | cut -d'"' -f4 | cut -d"v" -f2 | head -1) -} - -fluidd_dl_url(){ - get_fluidd_ver - FLUIDD_URL=https://github.com/cadriel/fluidd/releases/download/v$FLUIDD_VERSION/fluidd_v$FLUIDD_VERSION.zip + FLUIDD_VERSION=$(curl -s https://api.github.com/repositories/295836951/releases/latest | grep tag_name | cut -d'"' -f4 | cut -d"v" -f2) } fluidd_setup(){ - fluidd_dl_url + #get fluidd download url + FLUIDD_DL_URL=$(curl -s https://api.github.com/repositories/295836951/releases/latest | grep browser_download_url | cut -d'"' -f4) #clean up an existing fluidd folder [ -d $FLUIDD_DIR ] && rm -rf $FLUIDD_DIR #create fresh fluidd folder and download fluidd - mkdir $FLUIDD_DIR - cd $FLUIDD_DIR + mkdir $FLUIDD_DIR && cd $FLUIDD_DIR status_msg "Downloading Fluidd $FLUIDD_VERSION ..." - wget -O fluidd.zip $FLUIDD_URL && status_msg "Extracting archive ..." && unzip -o fluidd.zip && rm fluidd.zip - ### write fluidd version to file for update check reasons - echo "$FLUIDD_VERSION" > $FLUIDD_DIR/version + wget $FLUIDD_DL_URL && ok_msg "Download complete!" + #extract archive + status_msg "Unzipping archive ..." + unzip -q -o *.zip && ok_msg "Done!" + #write fluidd version to file for update check reasons + status_msg "Writing Fluidd version to file ..." + get_fluidd_ver && echo $FLUIDD_VERSION > $FLUIDD_DIR/version && ok_msg "Done!" + #delete downloaded zip + status_msg "Do a little cleanup ..." + rm -rf *.zip && ok_msg "Done!" && ok_msg "Fluidd installation complete!" echo } \ No newline at end of file -- 2.39.5 From e0b7a75116ed4583a78d53a66188122d2fc4be34 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Oct 2020 09:46:45 +0200 Subject: [PATCH 5/6] fix: update_all ui --- scripts/update.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/update.sh b/scripts/update.sh index 69c892b..0b0189b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -31,6 +31,9 @@ update_all(){ if [ "$MAINSAIL_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}● Mainsail${default} |" fi + if [ "$FLUIDD_UPDATE_AVAIL" = "true" ]; then + echo -e "| ${cyan}● Fluidd${default} |" + fi bottom_border if [ "${#update_arr[@]}" != "0" ]; then read -p "${cyan}###### Do you want to proceed? (Y/n):${default} " yn -- 2.39.5 From 29e3d8b3d278c164810f16834dc7f376c67bb2d3 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Oct 2020 16:41:00 +0200 Subject: [PATCH 6/6] add: log update function --- docs/changelog.md | 6 +++ scripts/ui/main_menu.sh | 23 +++++------ scripts/upload_log.sh | 89 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 14 deletions(-) create mode 100755 scripts/upload_log.sh diff --git a/docs/changelog.md b/docs/changelog.md index 605ac8a..bad301c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,12 @@ This document covers possible important changes to KIAUH. +### 2020-10-10: + +Support for changing the Klipper branch to the moonraker-dev branch from @Arksine has been dropped. Support for Moonraker has been merged into Klipper mainline a long time ago. + +A new function is available from the main menu. You can now upload your log files to http://paste.c-net.org/ to share them for debugging purposes. + ### 2020-10-06: Fluidd, a new Klipper interface got added to the list of available installers. At the same time some installation routines have changed or have seen some rework. Changes were made to the installation of NGINX configurations. A method was introduced to change the listen port of a webinterface configuration if there is already another webinterface listening on the default port (80).\ diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index c3280ec..9a43714 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -2,17 +2,15 @@ main_ui(){ top_border echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |" hr - echo -e "| | |" - echo -e "| 1) [Install] | Klipper: $KLIPPER_STATUS|" - echo -e "| 2) [Update] | Branch: ${cyan}$PRINT_BRANCH${default}|" + echo -e "| 0) [Upload Log] | Klipper: $KLIPPER_STATUS|" + echo -e "| | Branch: ${cyan}$PRINT_BRANCH${default}|" + echo -e "| 1) [Install] | |" + echo -e "| 2) [Update] | Moonraker: $MOONRAKER_STATUS|" echo -e "| 3) [Remove] | |" - echo -e "| | Moonraker: $MOONRAKER_STATUS|" - echo -e "| 4) [Advanced] | |" - echo -e "| 5) [Backup] | DWC2: $DWC2_STATUS|" - echo -e "| | Fluidd: $FLUIDD_STATUS|" - echo -e "| | Mainsail: $MAINSAIL_STATUS|" + echo -e "| | DWC2: $DWC2_STATUS|" + echo -e "| 4) [Advanced] | Fluidd: $FLUIDD_STATUS|" + echo -e "| 5) [Backup] | Mainsail: $MAINSAIL_STATUS|" echo -e "| | Octoprint: $OCTOPRINT_STATUS|" - echo -e "| | |" quit_footer } @@ -33,11 +31,8 @@ main_menu(){ print_msg && clear_msg main_ui while true; do - echo -e "${cyan}" - read -p "Perform action: " action; echo - echo -e "${default}" + read -p "${cyan}Perform action:${default} " action; echo case "$action" in - 8) read_listen_port;; update) clear print_header @@ -47,7 +42,7 @@ main_menu(){ 0) clear print_header - ERROR_MSG="Sorry this function is not implemented yet!" + upload_selection print_msg && clear_msg main_ui;; 1) diff --git a/scripts/upload_log.sh b/scripts/upload_log.sh new file mode 100755 index 0000000..aa8bf34 --- /dev/null +++ b/scripts/upload_log.sh @@ -0,0 +1,89 @@ +accept_upload_conditions(){ + while true; do + top_border + echo -e "| ${red}~~~~~~~~~~~ [ Upload Agreement ] ~~~~~~~~~~~~${default} |" + hr + echo -e "| The following function will help to quickly upload |" + echo -e "| logs for debugging purposes. With confirming this |" + echo -e "| dialog, you agree that during that process your logs |" + echo -e "| will be uploaded to: ${yellow}http://paste.c-net.org/${default} |" + hr + echo -e "| ${red}PLEASE NOTE:${default} |" + echo -e "| Be aware that logs can contain network information, |" + echo -e "| private data like usernames, filenames, or other |" + echo -e "| information you may not want to make public. |" + blank_line + echo -e "| Do ${red}NOT${default} use this function if you don't agree! |" + bottom_border + read -p "${cyan}Do you accept? (Y/n):${default} " yn + case "$yn" in + Y|y|Yes|yes|"") + sed -i "/logupload_accepted=/s/false/true/" $INI_FILE + clear && print_header && upload_selection + ;; + N|n|No|no) + clear + main_menu + break + ;; + *) + clear + print_header + print_unkown_cmd + print_msg && clear_msg + accept_upload_conditions;; + esac + done +} + +upload_selection(){ + source_ini + [ "$logupload_accepted" = "false" ] && accept_upload_conditions + KLIPPY_LOG=/tmp/klippy.log + MOONRAKER_LOG=/tmp/moonraker.log + DWC2_LOG=/tmp/dwc2.log + top_border + echo -e "| ${yellow}~~~~~~~~~~~~~~~ [ Log Upload ] ~~~~~~~~~~~~~~${default} |" + hr + echo -e "| You can choose the following files for uploading: |" + echo -e "| 1) klippy.log |" + echo -e "| 2) moonraker.log |" + echo -e "| 3) dwc2.log |" + quit_footer + while true; do + read -p "${cyan}Please select:${default} " choice + case "$choice" in + 1) + clear && print_header + upload_log "$KLIPPY_LOG" + upload_selection + ;; + 2) + clear && print_header + upload_log "$MOONRAKER_LOG" + upload_selection + ;; + 3) + clear && print_header + upload_log "$DWC2_LOG" + upload_selection + ;; + q | Q) clear; main_menu; break;; + esac + done +} + +upload_log(){ + if [ -f "$1" ]; then + status_msg "Uploading $1 ..." + LINK=$(curl -s --upload-file $1 'http://paste.c-net.org/') + [ ! -z "$LINK" ] && ok_msg "$1 upload successfull!" + echo -e "\n${cyan}###### Here is your link:${default}" + echo -e ">>>>>> $LINK\n" + unset LINK + else + clear && print_header + ERROR_MSG="$1 not found!" && print_msg && clear_msg + upload_selection + fi +} \ No newline at end of file -- 2.39.5