From bb2cdab02b412599f0119a02d56a2294d58ed719 Mon Sep 17 00:00:00 2001 From: Evgenii Shavrin <37345777+shavrin777@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:21:16 +0300 Subject: [PATCH 01/47] script: better moonraker service detection (#79) More accurate service search --- scripts/status.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/status.sh b/scripts/status.sh index 3633e42..cee1b04 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -99,7 +99,7 @@ moonraker_status(){ ) ### count amount of moonraker service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "moonraker" | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E 'moonraker\.service|moonraker-[[:digit:]]*.service' | wc -l) ### remove the "SERVICE" entry from the moonraker_data array if a moonraker service is installed [ $SERVICE_FILE_COUNT -gt 0 ] && unset moonraker_data[0] From f2a26d9b3d3fdfa32d54300dd8f22e4a316c77f3 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 15 Apr 2021 12:56:10 +0200 Subject: [PATCH 02/47] fix: false positive error message during klipper setup add fix some status.sh functions too --- scripts/install_klipper.sh | 5 ++++- scripts/status.sh | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 992f4a1..7c70b7d 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -7,7 +7,10 @@ klipper_setup_dialog(){ status_msg "Initializing Klipper installation ..." ### check for existing klipper service files - if $(ls /etc/init.d/klipper* 2>/dev/null 1>&2) || $(ls /etc/systemd/system/klipper*.service 2>/dev/null 1>&2); then + INITD=$(ls /etc/init.d | grep -E "^klipper(\-[[:digit:]]+)?$") + SYSTEMD=$(ls /etc/systemd/system | grep -E "^klipper(\-[[:digit:]]+)?\.service$") + + if [ ! -z "$INITD" ] || [ ! -z "$SYSTEMD" ]; then ERROR_MSG="At least one Klipper service is already installed!\n Please remove Klipper first, before installing it again." && return 0 fi diff --git a/scripts/status.sh b/scripts/status.sh index cee1b04..cb6a19f 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -30,7 +30,7 @@ klipper_status(){ ) ### count amount of klipper service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "klipper" | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "^klipper(\-[[:digit:]]+)?\.service$" | wc -l) ### a fix to detect an existing "legacy" klipper init.d installation if [ -f /etc/init.d/klipper ] && [ -f /etc/init.d/klipper ]; then @@ -68,7 +68,7 @@ dwc2_status(){ ) ### count amount of dwc service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "dwc" | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "^dwc(\-[[:digit:]]+)?\.service$" | wc -l) ### remove the "SERVICE" entry from the dwc_data array if a dwc service is installed [ $SERVICE_FILE_COUNT -gt 0 ] && unset dwc_data[0] @@ -99,7 +99,7 @@ moonraker_status(){ ) ### count amount of moonraker service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E 'moonraker\.service|moonraker-[[:digit:]]*.service' | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "^moonraker(\-[[:digit:]]+)?\.service$" | wc -l) ### remove the "SERVICE" entry from the moonraker_data array if a moonraker service is installed [ $SERVICE_FILE_COUNT -gt 0 ] && unset moonraker_data[0] @@ -175,7 +175,7 @@ octoprint_status(){ $OCTOPRINT_DIR ) ### count amount of octoprint service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "octoprint" | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "^octoprint(\-[[:digit:]]+)?\.service$" | wc -l) ### remove the "SERVICE" entry from the octoprint_data array if a octoprint service is installed [ $SERVICE_FILE_COUNT -gt 0 ] && unset octoprint_data[0] From 44f5609de62f6370d7dc4f0b54bc4ec506828167 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 20 Apr 2021 21:53:13 +0200 Subject: [PATCH 03/47] script: remove deprecated moonraker.conf entries --- resources/moonraker.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/moonraker.conf b/resources/moonraker.conf index a92e25a..189bccc 100644 --- a/resources/moonraker.conf +++ b/resources/moonraker.conf @@ -7,8 +7,6 @@ database_path: %MR_DB% klippy_uds_address: %UDS% [authorization] -enabled: True -api_key_file: ~/.moonraker_api_key trusted_clients: 127.0.0.1 %LAN% From 545b978e808426c105d75d5892fda692e4ea3a87 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 21 May 2021 08:55:11 +0200 Subject: [PATCH 04/47] update kiauh_macros.cfg Update macros to reflect recent changes to Klipper https://github.com/KevinOConnor/klipper/commit/f10247a498f2a73f5b2ffab931ff427951bf5342 --- resources/kiauh_macros.cfg | 51 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/resources/kiauh_macros.cfg b/resources/kiauh_macros.cfg index 3dba40f..9f4cf1f 100644 --- a/resources/kiauh_macros.cfg +++ b/resources/kiauh_macros.cfg @@ -1,9 +1,9 @@ -######################################################################################### -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AUTOCREATED WITH KIAUH ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -######################################################################################### -# Those are the recommended macros and config entries if you use Mainsail or Fluidd! # -# Feel free to edit or delete those macros if you already have them defined elsewhere! # -######################################################################################### +################################################################################ +# ~~~~~~~~~~~~~~~~~~~~~~~~ AUTOCREATED WITH KIAUH ~~~~~~~~~~~~~~~~~~~~~~~~~~ # +################################################################################ +# Recommended macros and config entries if you use Mainsail or Fluidd! # +# You can edit or delete those macros if you already defined them elsewhere! # +################################################################################ [pause_resume] @@ -19,20 +19,18 @@ gcode: [gcode_macro PAUSE] rename_existing: BASE_PAUSE -# change this if you need more or less extrusion -variable_extrude: 1.0 gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### set park positon for x and y ##### - # default is your max posion from your printer.cfg - {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} - {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} + ##### set defaults ##### + {% set x = params.X|default(230) %} #edit to your park position + {% set y = params.Y|default(230) %} #edit to your park position + {% set z = params.Z|default(10)|float %} #edit to your park position + {% set e = params.E|default(1) %} #edit to your retract length ##### calculate save lift position ##### {% set max_z = printer.toolhead.axis_maximum.z|float %} {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 2.0) %} - {% set z_safe = 2.0 %} + {% set lift_z = z|abs %} + {% if act_z < (max_z - lift_z) %} + {% set z_safe = lift_z %} {% else %} {% set z_safe = max_z - act_z %} {% endif %} @@ -40,21 +38,22 @@ gcode: SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE G91 - G1 E-{E} F2100 - G1 Z{z_safe} F900 + G1 E-{e} F2100 + G1 Z{z_safe} G90 - G1 X{x_park} Y{y_park} F6000 + G1 X{x} Y{y} F6000 + [gcode_macro RESUME] rename_existing: BASE_RESUME gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### end of definitions ##### + ##### set defaults ##### + {% set e = params.E|default(1) %} #edit to your retract length G91 - G1 E{E} F2100 - RESTORE_GCODE_STATE NAME=PAUSE_state + G1 E{e} F2100 + G90 + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME -######################################################################################### -######################################################################################### +################################################################################ +################################################################################ From 5b1da45688cf0dd4e7e16df48554957ee9c9ff28 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 23 May 2021 09:58:34 +0200 Subject: [PATCH 05/47] fix: typo in dialog of get_mcu_id --- scripts/install_klipper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 7c70b7d..ae3c713 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -387,7 +387,7 @@ get_mcu_id(){ bottom_border while true; do echo -e "${cyan}" - read -p "###### Press any key to continue ... " yn + read -p "###### Press ENTER to continue ... " yn echo -e "${default}" case "$yn" in *) From 87f229c62dbd4021e92850e8632bee74d02c2f09 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 23 May 2021 10:08:16 +0200 Subject: [PATCH 06/47] Update README.md --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index df6b00c..101d02c 100644 --- a/README.md +++ b/README.md @@ -31,18 +31,11 @@ git clone https://github.com/th33xitus/kiauh.git ./kiauh/kiauh.sh ``` -## Additional Instructions: - -If you need some more detailed instructions on how to install Klipper and Mainsail with KIAUH, check out this website:\ -[Installing Klipper and Mainsail](https://3dp.tumbleweedlabs.com/firmware/klipper-firmware/installing-klipper-and-mainsail-on-your-raspberry-pi)\ -Credits for these instructions go to [@tumbleweedlabs](https://github.com/tumbleweedlabs).\ -Feel free to check out his work. - --- ## **๐Ÿงฐ Functions and Features:** -- **New in v3.0** You can now install multiple instances (Klipper/Moonraker/DWC/Octoprint) on the same Pi! +- **New in v3.0.0:** You can now install multiple instances (Klipper/Moonraker/DWC/Octoprint) on the same Pi! --- ### **Core Functions:** @@ -67,18 +60,15 @@ Feel free to check out his work. ## **๐Ÿ“ Notes:** -- Tested **only** on Raspberry Pi OS Lite (Debian Buster) -- ( Although similar Debian based distributions might also work... ) +- Tested **only** on Raspberry Pi OS Lite (Debian 10 Buster) + - Other Debian based distributions can work + - Reported to work on Armbian too - During the use of this script you might be asked for your sudo password. There are several functions involved which need sudo privileges. --- ## **๐Ÿ›ˆ Sources & Further Information** -If you need some more detailed instructions on how to install Klipper and Mainsail with KIAUH, check out this website:\ -[Installing Klipper and Mainsail](https://3dp.tumbleweedlabs.com/firmware/klipper-firmware/installing-klipper-and-mainsail-on-your-raspberry-pi)\ -Credits for these instructions go to [@tumbleweedlabs](https://github.com/tumbleweedlabs). - For more information or instructions to the various components KIAUH can install, please check out the corresponding repositories listed below: --- From fb0a30814daadaaad48c5360fd39493264d7e644 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 23 May 2021 10:44:51 +0200 Subject: [PATCH 07/47] fix: validate user input for amount of Klipper instances to install --- scripts/install_klipper.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index ae3c713..9146a85 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -18,19 +18,19 @@ klipper_setup_dialog(){ check_klipper_cfg_path ### ask for amount of instances to create - while true; do + INSTANCE_COUNT="" + while [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; do + echo + read -p "${cyan}###### Amount of Klipper instances to set up:${default} " INSTANCE_COUNT + if [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; then + warn_msg "Invalid Input!" && echo + else echo - read -p "${cyan}###### How many Klipper instances do you want to set up?:${default} " INSTANCE_COUNT - echo - if [ $INSTANCE_COUNT == 1 ]; then - read -p "${cyan}###### Create $INSTANCE_COUNT single instance? (Y/n):${default} " yn - else - read -p "${cyan}###### Create $INSTANCE_COUNT instances? (Y/n):${default} " yn - fi + read -p "${cyan}###### Install $INSTANCE_COUNT instance(s)? (Y/n):${default} " yn case "$yn" in Y|y|Yes|yes|"") echo -e "###### > Yes" - status_msg "Creating $INSTANCE_COUNT Klipper instances ..." + status_msg "Installing $INSTANCE_COUNT Klipper instance(s) ..." klipper_setup break;; N|n|No|no) @@ -41,7 +41,8 @@ klipper_setup_dialog(){ *) print_unkown_cmd print_msg && clear_msg;; - esac + esac + fi done } From 6c8845d7b40d3b2bc9aed767e267851487b4b604 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 23 May 2021 11:38:32 +0200 Subject: [PATCH 08/47] script: show found services in error message --- scripts/install_klipper.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 9146a85..8ea4b1a 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -11,6 +11,7 @@ klipper_setup_dialog(){ SYSTEMD=$(ls /etc/systemd/system | grep -E "^klipper(\-[[:digit:]]+)?\.service$") if [ ! -z "$INITD" ] || [ ! -z "$SYSTEMD" ]; then + echo "${red}$INITD${default}" && echo "${red}$SYSTEMD${default}" ERROR_MSG="At least one Klipper service is already installed!\n Please remove Klipper first, before installing it again." && return 0 fi From cf20fc3c4868cbc856bf5311a31aec3869ab834d Mon Sep 17 00:00:00 2001 From: James Hildebrand Date: Mon, 24 May 2021 16:57:21 -0700 Subject: [PATCH 09/47] Issue 85 fix --- scripts/install_mjpg-streamer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_mjpg-streamer.sh b/scripts/install_mjpg-streamer.sh index 1551081..8e940e4 100755 --- a/scripts/install_mjpg-streamer.sh +++ b/scripts/install_mjpg-streamer.sh @@ -1,7 +1,7 @@ ### base variables SYSTEMDDIR="/etc/systemd/system" -WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/root/bin/webcamd" -WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/boot/mainsail.txt" +WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" +WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper-config/webcam.txt" install_mjpg-streamer(){ ### checking dependencies From 8abda56749154b3acf62d145b1938a24a38fc0f9 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 12:04:13 +0200 Subject: [PATCH 10/47] fix: typo in WEBCAM_TXT_SRC --- scripts/install_mjpg-streamer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_mjpg-streamer.sh b/scripts/install_mjpg-streamer.sh index 8e940e4..0769446 100755 --- a/scripts/install_mjpg-streamer.sh +++ b/scripts/install_mjpg-streamer.sh @@ -1,7 +1,7 @@ ### base variables SYSTEMDDIR="/etc/systemd/system" WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" -WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper-config/webcam.txt" +WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt" install_mjpg-streamer(){ ### checking dependencies From 9e0cdb0715d6a5382af8b66210e5471b351a3a92 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 12:13:36 +0200 Subject: [PATCH 11/47] fix: remove webcamd file when removing mjpgstreamer --- scripts/remove.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/remove.sh b/scripts/remove.sh index 604fe42..326c5b3 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -399,6 +399,11 @@ remove_mjpg-streamer(){ ok_msg "MJPG-Streamer Service removed!" fi + ### remove webcamd from /usr/local/bin + if [ -e "/usr/local/bin/webcamd" ]; then + sudo rm -f "/usr/local/bin/webcamd" + fi + ### remove MJPG-Streamer directory if [ -d ${HOME}/mjpg-streamer ]; then status_msg "Removing MJPG-Streamer directory ..." From 11b3d7a9618f44039c96a95e0a5140414a64f4ac Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 12:15:01 +0200 Subject: [PATCH 12/47] fix: replace config dir in webcamd file --- scripts/install_mjpg-streamer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_mjpg-streamer.sh b/scripts/install_mjpg-streamer.sh index 0769446..fc59f15 100755 --- a/scripts/install_mjpg-streamer.sh +++ b/scripts/install_mjpg-streamer.sh @@ -49,8 +49,8 @@ install_mjpg-streamer(){ EOT sudo wget $WEBCAMD_SRC -O "/usr/local/bin/webcamd" + sudo sed -i "/^config_dir=/ s|=.*|=$klipper_cfg_loc|" /usr/local/bin/webcamd sudo sed -i "/MJPGSTREAMER_HOME/ s/pi/${USER}/" /usr/local/bin/webcamd - sudo sed -i "/^cfg_files+=/ s|=.*|=$WEBCAM_TXT|" /usr/local/bin/webcamd sudo chmod +x /usr/local/bin/webcamd ### step 4: create webcam.txt config file From a83585fb061abe7f04ab88292b103b4d5c5dbc75 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 18:39:37 +0200 Subject: [PATCH 13/47] fix: improve pattern matching --- scripts/install_moonraker.sh | 8 ++++-- scripts/remove.sh | 54 ++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 0dfd251..cce9ce9 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -46,15 +46,19 @@ moonraker_setup_dialog(){ print_msg && clear_msg && return 0 fi + shopt -s extglob # enable extended globbing ### check for existing moonraker service installations - if ls /etc/systemd/system/moonraker*.service 2>/dev/null 1>&2; then + FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service" + if ls $FILE 2>/dev/null 1>&2; then ERROR_MSG="At least one Moonraker service is already installed!" && return 0 fi ### check for existing klipper service installations - if ! ls /etc/systemd/system/klipper*.service 2>/dev/null 1>&2; then + FILE="$SYSTEMDDIR/klipper?(-*([0-9])).service" + if ! ls $FILE 2>/dev/null 1>&2; then ERROR_MSG="Klipper service not found, please install Klipper first!" && return 0 fi + shopt -u extglob # disable extended globbing ### count amount of klipper services if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then diff --git a/scripts/remove.sh b/scripts/remove.sh index 326c5b3..1c33db6 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -2,6 +2,7 @@ SYSTEMDDIR="/etc/systemd/system" remove_klipper(){ + shopt -s extglob # enable extended globbing ### ask the user if he wants to uninstall moonraker too. ###? currently usefull if the user wants to switch from single-instance to multi-instance if ls /etc/systemd/system/moonraker*.service 2>/dev/null 1>&2; then @@ -45,9 +46,10 @@ remove_klipper(){ fi ### remove all klipper services - if ls /etc/systemd/system/klipper*.service 2>/dev/null 1>&2; then + FILE="$SYSTEMDIR/klipper?(-*([0-9])).service" + if ls $FILE 2>/dev/null 1>&2; then status_msg "Removing Klipper Services ..." - for service in $(ls /etc/systemd/system/klipper*.service | cut -d"/" -f5) + for service in $(ls $FILE | cut -d"/" -f5) do status_msg "Removing $service ..." sudo systemctl stop $service @@ -62,32 +64,32 @@ remove_klipper(){ fi ### remove all logfiles - if ls /tmp/klippy*.log 2>/dev/null 1>&2; then - for logfile in $(ls /tmp/klippy*.log) - do - status_msg "Removing $logfile ..." - rm -f $logfile - ok_msg "File '$logfile' removed!" + FILE="/tmp/klippy?(-*([0-9])).log" + if ls $FILE 2>/dev/null 1>&2; then + for log in $(ls $FILE); do + status_msg "Removing $log ..." + rm -f $log + ok_msg "$log removed!" done fi ### remove all UDS - if ls /tmp/klippy_uds* 2>/dev/null 1>&2; then - for uds in $(ls /tmp/klippy_uds*) - do + FILE="/tmp/klippy_uds?(-*([0-9]))" + if ls $FILE 2>/dev/null 1>&2; then + for uds in $(ls $FILE); do status_msg "Removing $uds ..." rm -f $uds - ok_msg "File '$uds' removed!" + ok_msg "$uds removed!" done fi ### remove all tmp-printer - if ls /tmp/printer* 2>/dev/null 1>&2; then - for tmp_printer in $(ls /tmp/printer*) - do + FILE="/tmp/printer?(-*([0-9]))" + if ls $FILE 2>/dev/null 1>&2; then + for tmp_printer in $(ls $FILE); do status_msg "Removing $tmp_printer ..." rm -f $tmp_printer - ok_msg "File '$tmp_printer' removed!" + ok_msg "$tmp_printer removed!" done fi @@ -102,6 +104,7 @@ remove_klipper(){ fi CONFIRM_MSG=" Klipper was successfully removed!" && print_msg && clear_msg + shopt -u extglob # enable extended globbing if [ "$REM_MR" == "true" ]; then remove_moonraker && unset REM_MR @@ -112,6 +115,7 @@ remove_klipper(){ ############################################################# remove_moonraker(){ + shopt -s extglob # enable extended globbing ### remove "legacy" moonraker init.d service if [ -f /etc/init.d/moonraker ]; then status_msg "Removing Moonraker Service ..." @@ -123,9 +127,10 @@ remove_moonraker(){ fi ### remove all moonraker services - if ls /etc/systemd/system/moonraker*.service 2>/dev/null 1>&2; then + FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service" + if ls $FILE 2>/dev/null 1>&2; then status_msg "Removing Moonraker Services ..." - for service in $(ls /etc/systemd/system/moonraker*.service | cut -d"/" -f5) + for service in $(ls $FILE | cut -d"/" -f5) do status_msg "Removing $service ..." sudo systemctl stop $service @@ -140,12 +145,12 @@ remove_moonraker(){ fi ### remove all logfiles - if ls /tmp/moonraker*.log 2>/dev/null 1>&2; then - for logfile in $(ls /tmp/moonraker*.log) - do - status_msg "Removing $logfile ..." - rm -f $logfile - ok_msg "File '$logfile' removed!" + FILE="/tmp/moonraker?(-*([0-9])).log" + if ls $FILE 2>/dev/null 1>&2; then + for log in $(ls $FILE); do + status_msg "Removing $log ..." + rm -f $log + ok_msg "$log removed!" done fi @@ -176,6 +181,7 @@ remove_moonraker(){ fi CONFIRM_MSG=" Moonraker was successfully removed!" + shopt -u extglob # disable extended globbing } ############################################################# From 9a3814f4803e659eb17ba4ce1315628f8a1bc014 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 18:49:45 +0200 Subject: [PATCH 14/47] fix: typo in SYSTEMDDIR variable --- scripts/remove.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index 1c33db6..6af4f65 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -46,7 +46,7 @@ remove_klipper(){ fi ### remove all klipper services - FILE="$SYSTEMDIR/klipper?(-*([0-9])).service" + FILE="$SYSTEMDDIR/klipper?(-*([0-9])).service" if ls $FILE 2>/dev/null 1>&2; then status_msg "Removing Klipper Services ..." for service in $(ls $FILE | cut -d"/" -f5) From 0815d7778c74f4b03515c24253dd6cd57c97d306 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 25 May 2021 18:53:07 +0200 Subject: [PATCH 15/47] feat: add cyberpunk theme to mainsail theme installer --- scripts/ms_theme_installer.sh | 17 +++++++++++++++++ scripts/ui/ms_theme_menu.sh | 14 ++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/ms_theme_installer.sh b/scripts/ms_theme_installer.sh index b1fc00b..30fad4c 100755 --- a/scripts/ms_theme_installer.sh +++ b/scripts/ms_theme_installer.sh @@ -53,6 +53,23 @@ ms_theme_dracula(){ [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" cd $THEME_PATH && git clone "$THEME_URL" ".theme" + ok_msg "Theme installation complete!" + ok_msg "Please remember to delete your browser cache!\n" +} + +ms_theme_cyberpunk(){ + THEME_URL="https://github.com/Dario-Ciceri/cp2077-mainsail-theme" + + ### check and select printer if there is more than 1 + check_select_printer + + ### download all files + status_msg "Installing Cyberpunk theme ..." + status_msg "Please wait ..." + + [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" + cd $THEME_PATH && git clone "$THEME_URL" ".theme" + ok_msg "Theme installation complete!" ok_msg "Please remember to delete your browser cache!\n" } \ No newline at end of file diff --git a/scripts/ui/ms_theme_menu.sh b/scripts/ui/ms_theme_menu.sh index c4b2bdd..79816d0 100755 --- a/scripts/ui/ms_theme_menu.sh +++ b/scripts/ui/ms_theme_menu.sh @@ -8,6 +8,7 @@ ms_theme_ui(){ hr echo -e "| Theme: | " echo -e "| 1) [Dracula] | " + echo -e "| 2) [Cyberpunk] | " echo -e "| | " echo -e "| R) [Remove Theme] | " echo -e "| | " @@ -19,14 +20,11 @@ ms_theme_menu(){ while true; do read -p "${cyan}Perform action:${default} " action; echo case "$action" in - 1) - do_action "ms_theme_dracula" "ms_theme_ui";; - R|r) - do_action "ms_theme_delete" "ms_theme_ui";; - Q|q) - clear; advanced_menu; break;; - *) - deny_action "ms_theme_ui";; + 1) do_action "ms_theme_dracula" "ms_theme_ui";; + 2) do_action "ms_theme_cyberpunk" "ms_theme_ui";; + R|r) do_action "ms_theme_delete" "ms_theme_ui";; + Q|q) clear; advanced_menu; break;; + *) deny_action "ms_theme_ui";; esac done ms_theme_menu From bf33c77db714bd4dd592b6958d468f23ad012c7b Mon Sep 17 00:00:00 2001 From: cron410 Date: Fri, 4 Jun 2021 07:51:30 -0400 Subject: [PATCH 16/47] script: install_klipper.sh prompt phrasing (#90) --- scripts/install_klipper.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 8ea4b1a..d017996 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -22,7 +22,7 @@ klipper_setup_dialog(){ INSTANCE_COUNT="" while [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; do echo - read -p "${cyan}###### Amount of Klipper instances to set up:${default} " INSTANCE_COUNT + read -p "${cyan}###### Number of Klipper instances to set up:${default} " INSTANCE_COUNT if [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; then warn_msg "Invalid Input!" && echo else @@ -417,4 +417,4 @@ get_mcu_id(){ warn_msg "Could not retrieve ID!" warn_msg "Printer not plugged in or not detectable!" fi -} \ No newline at end of file +} From 5d11cd212a5592c4348c42983586f91ee0209d67 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 4 Jun 2021 14:01:54 +0200 Subject: [PATCH 17/47] script: update install_moonraker.sh (#89) --- scripts/install_moonraker.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index cce9ce9..8b4718d 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -147,6 +147,7 @@ moonraker_setup(){ install_moonraker_packages(){ PKGLIST="python3-virtualenv python3-dev nginx libopenjp2-7 python3-libgpiod" + PKGLIST="${PKGLIST} liblmdb0 libsodium-dev zlib1g-dev" ### Update system package info status_msg "Running apt-get update..." @@ -166,7 +167,10 @@ create_moonraker_virtualenv(){ rm -rf ${MOONRAKER_ENV} fi - [ ! -d ${MOONRAKER_ENV} ] && virtualenv -p /usr/bin/python3 --system-site-packages ${MOONRAKER_ENV} + if [ ! -d ${MOONRAKER_ENV} ]; then + virtualenv -p /usr/bin/python3 ${MOONRAKER_ENV} + ln -s /usr/lib/python3/dist-packages/gpiod* ${MOONRAKER_ENV}/lib/python*/site-packages + fi ### Install/update dependencies ${MOONRAKER_ENV}/bin/pip install -r ${MOONRAKER_DIR}/scripts/moonraker-requirements.txt From 02ef0578e3536e84cc08fff89f08bca433c1058c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 8 Jun 2021 17:54:23 +0200 Subject: [PATCH 18/47] script: reading klipper/moonraker dependencies from their respective install scripts --- scripts/install_klipper.sh | 25 +++++++++++-------------- scripts/install_moonraker.sh | 12 +++++++++--- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index d017996..5f82b4a 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -48,19 +48,16 @@ klipper_setup_dialog(){ } install_klipper_packages(){ - ### Packages for python cffi - PKGLIST="python-virtualenv virtualenv python-dev libffi-dev build-essential" - ### kconfig requirements - PKGLIST="${PKGLIST} libncurses-dev" - ### hub-ctrl - PKGLIST="${PKGLIST} libusb-dev" - ### AVR chip installation and building - PKGLIST="${PKGLIST} avrdude gcc-avr binutils-avr avr-libc" - ### ARM chip installation and building - PKGLIST="${PKGLIST} stm32flash libnewlib-arm-none-eabi" - PKGLIST="${PKGLIST} gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0" - ### dbus requirement for DietPi - PKGLIST="${PKGLIST} dbus" + ### read PKGLIST from official install script + status_msg "Reading dependencies..." + install_script="${HOME}/klipper/scripts/install-octopi.sh" + PKGLIST=$(grep "PKGLIST=" $install_script | sed 's/PKGLIST//g; s/[$={}\n"]//g') + ### rewrite packages into new array + unset PKGARR + for PKG in $PKGLIST; do PKGARR+=($PKG); done + ### add dbus requirement for DietPi distro + PKGARR+=("dbus") + echo "${cyan}${PKGARR[@]}${default}" ### Update system package info status_msg "Running apt-get update..." @@ -68,7 +65,7 @@ install_klipper_packages(){ ### Install desired packages status_msg "Installing packages..." - sudo apt-get install --yes ${PKGLIST} + sudo apt-get install --yes ${PKGARR[@]} } create_klipper_virtualenv(){ diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 8b4718d..bf79dbc 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -146,8 +146,14 @@ moonraker_setup(){ } install_moonraker_packages(){ - PKGLIST="python3-virtualenv python3-dev nginx libopenjp2-7 python3-libgpiod" - PKGLIST="${PKGLIST} liblmdb0 libsodium-dev zlib1g-dev" + ### read PKGLIST from official install script + status_msg "Reading dependencies..." + install_script="${HOME}/moonraker/scripts/install-moonraker.sh" + PKGLIST=$(grep "PKGLIST=" $install_script | sed 's/PKGLIST//g; s/[$={}\n"]//g') + ### rewrite packages into new array + unset PKGARR + for PKG in $PKGLIST; do PKGARR+=($PKG); done + echo "${cyan}${PKGARR[@]}${default}" ### Update system package info status_msg "Running apt-get update..." @@ -155,7 +161,7 @@ install_moonraker_packages(){ ### Install desired packages status_msg "Installing packages..." - sudo apt-get install --yes ${PKGLIST} + sudo apt-get install --yes ${PKGARR[@]} } create_moonraker_virtualenv(){ From 0edfc746d407de9bed91a81fa2c4e0d820173d9c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 8 Jun 2021 17:55:40 +0200 Subject: [PATCH 19/47] script: improve dependency checks on klipper/moonraker update --- scripts/update.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 616a541..f3f27fc 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -72,18 +72,23 @@ update_klipper(){ save_klipper_state status_msg "Updating $GET_BRANCH" cd $KLIPPER_DIR - KLIPPER_OLDREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)" if [ "$DETACHED_HEAD" == "true" ]; then git checkout $GET_BRANCH unset DETACHED_HEAD fi + ### get current klippy-requirements.txt md5sum + KLIPPER_OLDREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)" ### pull latest files from github - git pull && ok_msg "Update successfull!" + git pull + ### read PKGLIST and install possible new dependencies + install_klipper_packages + ### get possible new klippy-requirements.txt md5sum + KLIPPER_NEWREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)" ### check for possible new dependencies and install them - if [[ $(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1) != $KLIPPER_OLDREQ_MD5SUM ]]; then + if [[ $KLIPPER_NEWREQ_MD5SUM != $KLIPPER_OLDREQ_MD5SUM ]]; then PYTHONDIR="${HOME}/klippy-env" status_msg "New dependecies detected..." @@ -132,13 +137,18 @@ update_moonraker(){ bb4u "moonraker" status_msg "Updating Moonraker ..." cd $MOONRAKER_DIR - MOONRAKER_OLDREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) + ### get current moonraker-requirements.txt md5sum + MOONRAKER_OLDREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) ### pull latest files from github - git pull && ok_msg "Update successfull!" + git pull + ### read PKGLIST and install possible new dependencies + install_moonraker_packages + ### get possible new moonraker-requirements.txt md5sum + MOONRAKER_NEWREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) ### check for possible new dependencies and install them - if [[ $(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) != $MOONRAKER_OLDREQ_MD5SUM ]]; then + if [[ $MOONRAKER_NEWREQ_MD5SUM != $MOONRAKER_OLDREQ_MD5SUM ]]; then PYTHONDIR="${HOME}/moonraker-env" status_msg "New dependecies detected..." ### always rebuild the pythondir from scratch if new dependencies were detected From f804fcb65dd36a9ae6c8ee0e39f38d83c356b8c4 Mon Sep 17 00:00:00 2001 From: jordanruthe <31575189+jordanruthe@users.noreply.github.com> Date: Sun, 13 Jun 2021 11:39:12 -0400 Subject: [PATCH 20/47] update: Fix detached head on KlipperScreen update (#93) --- scripts/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update.sh b/scripts/update.sh index f3f27fc..3c6ff12 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -168,7 +168,7 @@ update_klipperscreen(){ cd $KLIPPERSCREEN_DIR KLIPPERSCREEN_OLDREQ_MD5SUM=$(md5sum $KLIPPERSCREEN_DIR/scripts/KlipperScreen-requirements.txt | cut -d " " -f1) git pull origin master -q && ok_msg "Fetch successfull!" - git checkout -f origin/master && ok_msg "Checkout successfull" + git checkout -f master && ok_msg "Checkout successfull" #KLIPPERSCREEN_NEWREQ_MD5SUM=$(md5sum $KLIPPERSCREEN_DIR/scripts/KlipperScreen-requirements.txt) if [[ $(md5sum $KLIPPERSCREEN_DIR/scripts/KlipperScreen-requirements.txt | cut -d " " -f1) != $KLIPPERSCREEN_OLDREQ_MD5SUM ]]; then status_msg "New dependecies detected..." From d344b1c5f6d13066dd64387cbf7fb2d4725d47de Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 11 Jun 2021 12:09:10 +0200 Subject: [PATCH 21/47] feat: auto mainsailOS / fluiddPi migration script: make use of moonrakers new log_path configuration option script: create webui nginx log symlinks upon installation/update --- resources/moonraker.conf | 1 + scripts/install_klipper.sh | 7 +-- scripts/install_klipper_webui.sh | 20 ++++++++ scripts/install_mjpg-streamer.sh | 7 +++ scripts/install_moonraker.sh | 6 ++- scripts/remove.sh | 27 +++++++++-- scripts/update.sh | 83 ++++++++++++++++++++++++++++++-- 7 files changed, 140 insertions(+), 11 deletions(-) diff --git a/resources/moonraker.conf b/resources/moonraker.conf index 189bccc..c77ac32 100644 --- a/resources/moonraker.conf +++ b/resources/moonraker.conf @@ -3,6 +3,7 @@ host: 0.0.0.0 port: %PORT% enable_debug_logging: False config_path: %CFG% +log_path: %LOG% database_path: %MR_DB% klippy_uds_address: %UDS% diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 5f82b4a..ce63d43 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -89,8 +89,9 @@ klipper_setup(){ install_klipper_packages create_klipper_virtualenv - ### step 3: create shared gcode_files folder + ### step 3: create shared gcode_files and logs folder [ ! -d ${HOME}/gcode_files ] && mkdir -p ${HOME}/gcode_files + [ ! -d ${HOME}/klipper_logs ] && mkdir -p ${HOME}/klipper_logs ### step 4: create klipper instances create_klipper_service @@ -110,7 +111,7 @@ create_klipper_service(){ CFG_PATH="$klipper_cfg_loc" KL_ENV=$KLIPPY_ENV KL_DIR=$KLIPPER_DIR - KL_LOG="/tmp/klippy.log" + KL_LOG="${HOME}/klipper_logs/klippy.log" KL_UDS="/tmp/klippy_uds" P_TMP="/tmp/printer" P_CFG="$CFG_PATH/printer.cfg" @@ -154,7 +155,7 @@ create_klipper_service(){ KL_SERV_TARGET="$SYSTEMDDIR/klipper-$i.service" P_TMP="/tmp/printer-$i" P_CFG="$CFG_PATH/printer.cfg" - KL_LOG="/tmp/klippy-$i.log" + KL_LOG="${HOME}/klipper_logs/klippy-$i.log" KL_UDS="/tmp/klippy_uds-$i" ### write multi instance service write_kl_service diff --git a/scripts/install_klipper_webui.sh b/scripts/install_klipper_webui.sh index ac9ed51..e949cf9 100755 --- a/scripts/install_klipper_webui.sh +++ b/scripts/install_klipper_webui.sh @@ -100,6 +100,9 @@ install_webui(){ ### creating the mainsail/fluidd nginx cfg set_nginx_cfg "$1" + ### symlink nginx log + symlink_webui_nginx_log "$1" + ### copy the kiauh_macros.cfg to the config location install_kiauh_macros @@ -114,6 +117,23 @@ install_webui(){ print_msg && clear_msg } +symlink_webui_nginx_log(){ + LPATH="${HOME}/klipper_logs" + UI_ACCESS_LOG="/var/log/nginx/$1-access.log" + UI_ERROR_LOG="/var/log/nginx/$1-error.log" + [ ! -d "$LPATH" ] && mkdir -p "$LPATH" + if [ -f "$UI_ACCESS_LOG" ] && [ ! -L "$LPATH/$1-access.log" ]; then + status_msg "Creating symlink for $UI_ACCESS_LOG ..." + ln -s $UI_ACCESS_LOG "$LPATH" + ok_msg "OK!" + fi + if [ -f "$UI_ERROR_LOG" ] && [ ! -L "$LPATH/$1-error.log" ]; then + status_msg "Creating symlink for $UI_ERROR_LOG ..." + ln -s $UI_ERROR_LOG "$LPATH" + ok_msg "OK!" + fi +} + install_kiauh_macros(){ source_kiauh_ini ### copy kiauh_macros.cfg diff --git a/scripts/install_mjpg-streamer.sh b/scripts/install_mjpg-streamer.sh index fc59f15..f58e0c8 100755 --- a/scripts/install_mjpg-streamer.sh +++ b/scripts/install_mjpg-streamer.sh @@ -65,6 +65,7 @@ EOT status_msg "Creating MJPG-Streamer service ..." sudo cp $MJPG_SERV_SRC $MJPG_SERV_TARGET sudo sed -i "s|%USER%|${USER}|" $MJPG_SERV_TARGET + ok_msg "MJPG-Streamer service created!" ### step 6: enabling and starting mjpg-streamer service status_msg "Starting MJPG-Streamer service ..." @@ -72,6 +73,12 @@ EOT sudo systemctl start webcamd.service ok_msg "MJPG-Streamer service started!" + ### step 6.1: create webcamd.log symlink + [ ! -d ${HOME}/klipper_logs ] && mkdir -p "${HOME}/klipper_logs" + if [ -f "/var/log/webcamd.log" ] && [ ! -L "${HOME}/klipper_logs/webcamd.log" ]; then + ln -s "/var/log/webcamd.log" "${HOME}/klipper_logs/webcamd.log" + fi + ### confirm message CONFIRM_MSG="MJPG-Streamer has been set up!" print_msg && clear_msg diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index bf79dbc..6abe1fd 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -191,7 +191,7 @@ create_moonraker_service(){ CFG_PATH="$klipper_cfg_loc" MR_ENV=$MOONRAKER_ENV MR_DIR=$MOONRAKER_DIR - MR_LOG="/tmp/moonraker.log" + MR_LOG="${HOME}/klipper_logs/moonraker.log" MR_CONF="$CFG_PATH/moonraker.conf" MR_SERV_SRC="${SRCDIR}/kiauh/resources/moonraker.service" MR_SERV_TARGET="$SYSTEMDDIR/moonraker.service" @@ -225,7 +225,7 @@ create_moonraker_service(){ CFG_PATH="$klipper_cfg_loc/printer_$i" MR_SERV_TARGET="$SYSTEMDDIR/moonraker-$i.service" MR_CONF="$CFG_PATH/moonraker.conf" - MR_LOG="/tmp/moonraker-$i.log" + MR_LOG="${HOME}/klipper_logs/moonraker-$i.log" ### write multi instance service write_mr_service ### enable instance @@ -258,6 +258,7 @@ create_moonraker_conf(){ SINGLE_INST=1 PORT=7125 CFG_PATH="$klipper_cfg_loc" + LOG_PATH="${HOME}/klipper_logs" MR_CONF="$CFG_PATH/moonraker.conf" MR_DB="~/.moonraker_database" KLIPPY_UDS="/tmp/klippy_uds" @@ -273,6 +274,7 @@ create_moonraker_conf(){ cp $MR_CONF_SRC $MR_CONF sed -i "s|%PORT%|$PORT|" $MR_CONF sed -i "s|%CFG%|$CFG_PATH|" $MR_CONF + sed -i "s|%LOG%|$LOG_PATH|" $MR_CONF sed -i "s|%MR_DB%|$MR_DB|" $MR_CONF sed -i "s|%UDS%|$KLIPPY_UDS|" $MR_CONF sed -i "s|%LAN%|$LAN|" $MR_CONF diff --git a/scripts/remove.sh b/scripts/remove.sh index 6af4f65..77c47bd 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -5,7 +5,8 @@ remove_klipper(){ shopt -s extglob # enable extended globbing ### ask the user if he wants to uninstall moonraker too. ###? currently usefull if the user wants to switch from single-instance to multi-instance - if ls /etc/systemd/system/moonraker*.service 2>/dev/null 1>&2; then + FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service" + if ls $FILE 2>/dev/null 1>&2; then while true; do unset REM_MR top_border @@ -64,7 +65,7 @@ remove_klipper(){ fi ### remove all logfiles - FILE="/tmp/klippy?(-*([0-9])).log" + FILE="${HOME}/klipper_logs/klippy?(-*([0-9])).log" if ls $FILE 2>/dev/null 1>&2; then for log in $(ls $FILE); do status_msg "Removing $log ..." @@ -145,7 +146,7 @@ remove_moonraker(){ fi ### remove all logfiles - FILE="/tmp/moonraker?(-*([0-9])).log" + FILE="${HOME}/klipper_logs/moonraker?(-*([0-9])).log" if ls $FILE 2>/dev/null 1>&2; then for log in $(ls $FILE); do status_msg "Removing $log ..." @@ -264,6 +265,14 @@ remove_mainsail(){ sudo rm /etc/nginx/sites-enabled/mainsail && ok_msg "File removed!" fi + ### remove mainsail nginx logs and log symlinks + for log in $(find /var/log/nginx -name "mainsail*"); do + sudo rm -f $log + done + for log in $(find ${HOME}/klipper_logs -name "mainsail*"); do + rm -f $log + done + CONFIRM_MSG="Mainsail successfully removed!" } @@ -286,6 +295,14 @@ remove_fluidd(){ sudo rm /etc/nginx/sites-enabled/fluidd && ok_msg "File removed!" fi + ### remove mainsail nginx logs and log symlinks + for log in $(find /var/log/nginx -name "fluidd*"); do + sudo rm -f $log + done + for log in $(find ${HOME}/klipper_logs -name "fluidd*"); do + rm -f $log + done + CONFIRM_MSG="Fluidd successfully removed!" } @@ -417,5 +434,9 @@ remove_mjpg-streamer(){ ok_msg "MJPG-Streamer directory removed!" fi + ### remove webcamd log and symlink + [ -f "/var/log/webcamd.log" ] && sudo rm -f "/var/log/webcamd.log" + [ -L "${HOME}/klipper_logs/webcamd.log" ] && rm -f "${HOME}/klipper_logs/webcamd.log" + CONFIRM_MSG="MJPG-Streamer successfully removed!" } \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 3c6ff12..f7f49ae 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -62,6 +62,79 @@ update_all(){ done } +update_log_paths(){ + ### update services to make use of moonrakers new log_path option + ### https://github.com/Arksine/moonraker/commit/829b3a4ee80579af35dd64a37ccc092a1f67682a + shopt -s extglob # enable extended globbing + LPATH="${HOME}/klipper_logs" + [ ! -d "$LPATH" ] && mkdir -p "$LPATH" + FILE="$SYSTEMDDIR/$1?(-*([0-9])).service" + for file in $(ls $FILE); do + [ "$1" == "klipper" ] && LOG="klippy" + [ "$1" == "moonraker" ] && LOG="moonraker" + if [ ! "$(grep "\-l" $file)" ]; then + status_msg "Updating $file ..." + sudo sed -i -r "/ExecStart=/ s|$| -l $LPATH/$LOG.log|" $file + ok_msg "$file updated!" + elif [ "$(grep "\-l \/tmp\/$LOG" $file)" ]; then + status_msg "Updating $file ..." + sudo sed -i -r "/ExecStart=/ s|-l \/tmp\/$LOG|-l $LPATH/$LOG|" $file + ok_msg "$file updated!" + fi + done + sudo systemctl daemon-reload + + # create symlink for mainsail and fluidd nginx logs + symlink_webui_nginx_log "mainsail" + symlink_webui_nginx_log "fluidd" + + # create symlink for webcamd log + if [ -f "/var/log/webcamd.log" ] && [ ! -L "$LPATH/webcamd.log" ]; then + status_msg "Creating symlink for '/var/log/webcamd.log' ..." + ln -s "/var/log/webcamd.log" "$LPATH" + ok_msg "OK!" + fi + + shopt -u extglob # disable extended globbing +} + +migrate_custompios(){ + ### migrate vanilla mainsailOS 0.4.0 and fluiddPI v1.13.0 + ### and older to be in sync with their newer releases + if [ -f "/boot/$1.txt" ]; then + status_msg "Starting migration... Please wait..." + ### migrate webcam related stuff + WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" + MJPG_SERV_SRC="${SRCDIR}/kiauh/resources/webcamd.service" + MJPG_SERV_TARGET="$SYSTEMDDIR/webcamd.service" + KL_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/dev-klipper-serviced/src/modules/klipper/filesystem/root/etc/systemd/system/klipper.service" + # stop webcam service + sudo systemctl stop webcamd.service + # replace old webcamd.service + sudo rm -f "$SYSTEMDDIR/webcamd.service" + # replace old webcamd + sudo rm -f "/root/bin/webcamd" + sudo cp $MJPG_SERV_SRC $MJPG_SERV_TARGET + sudo sed -i "s|%USER%|pi|" $MJPG_SERV_TARGET + sudo wget $WEBCAMD_SRC -O "/usr/local/bin/webcamd" + sudo chmod +x /usr/local/bin/webcamd + # copy mainsail.txt or fluidd.txt to klipper_config and rename it + sudo mv "/boot/$1.txt" "${HOME}/klipper_config/webcam.txt" + sudo chown pi:pi "${HOME}/klipper_config/webcam.txt" + ### migrate klipper related stuff + sudo service klipper stop + # stop and remove init.d klipper service + sudo update-rc.d -f klipper remove + sudo rm -f /etc/init.d/klipper + sudo rm -f /etc/default/klipper + # create new systemd service + sudo wget $KL_SERV_SRC -O "/etc/systemd/system/klipper.service" + sudo systemctl enable klipper.service + sudo systemctl daemon-reload + ok_msg "Migration complete!" + fi +} + update_klipper(){ klipper_service "stop" if [ ! -d $KLIPPER_DIR ]; then @@ -98,9 +171,11 @@ update_klipper(){ $PYTHONDIR/bin/pip install -r $KLIPPER_DIR/scripts/klippy-requirements.txt ok_msg "Dependencies have been installed!" fi - - ok_msg "Update complete!" fi + migrate_custompios "mainsail" + migrate_custompios "fluiddpi" + update_log_paths "klipper" + ok_msg "Update complete!" klipper_service "restart" } @@ -124,12 +199,14 @@ update_mainsail(){ bb4u "mainsail" status_msg "Updating Mainsail ..." mainsail_setup + symlink_webui_nginx_log "mainsail" } update_fluidd(){ bb4u "fluidd" status_msg "Updating Fluidd ..." fluidd_setup + symlink_webui_nginx_log "fluidd" } update_moonraker(){ @@ -158,7 +235,7 @@ update_moonraker(){ ${PYTHONDIR}/bin/pip install -r $MOONRAKER_DIR/scripts/moonraker-requirements.txt ok_msg "Dependencies have been installed!" fi - + update_log_paths "moonraker" ok_msg "Update complete!" moonraker_service "restart" } From 19b37e4dc4fa1681dc4797a1b7ebd19fa59b490e Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 11 Jun 2021 12:32:57 +0200 Subject: [PATCH 22/47] script: update klipper.service raw file link --- scripts/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update.sh b/scripts/update.sh index f7f49ae..1a26aa0 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -107,7 +107,7 @@ migrate_custompios(){ WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" MJPG_SERV_SRC="${SRCDIR}/kiauh/resources/webcamd.service" MJPG_SERV_TARGET="$SYSTEMDDIR/webcamd.service" - KL_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/dev-klipper-serviced/src/modules/klipper/filesystem/root/etc/systemd/system/klipper.service" + KL_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/klipper/filesystem/root/etc/systemd/system/klipper.service" # stop webcam service sudo systemctl stop webcamd.service # replace old webcamd.service From 98f0aa4b8fc3afa8fb07e346392edc74567a1a74 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 11 Jun 2021 12:35:29 +0200 Subject: [PATCH 23/47] script: update log-upload function --- scripts/upload_log.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/upload_log.sh b/scripts/upload_log.sh index c203ef1..03d3584 100755 --- a/scripts/upload_log.sh +++ b/scripts/upload_log.sh @@ -42,13 +42,16 @@ upload_selection(){ ### find all suitable logfiles for klipper logfiles=() - if ls /tmp/klippy*.log 2>/dev/null 1>&2; then - for kl_log in $(find /tmp/klippy*.log); do + klipper_logs="${HOME}/klipper_logs/klippy*.log" + moonraker_logs="${HOME}/klipper_logs/moonraker*.log" + + if ls $klipper_logs 2>/dev/null 1>&2; then + for kl_log in $(find $klipper_logs); do logfiles+=($kl_log) done fi - if ls /tmp/moonraker*.log 2>/dev/null 1>&2; then - for mr_log in $(find /tmp/moonraker*.log); do + if ls $moonraker_logs 2>/dev/null 1>&2; then + for mr_log in $(find $moonraker_logs); do logfiles+=($mr_log) done fi From 9fd3f930df55f3a4201a549ac7e44e9fa4f50027 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 13 Jun 2021 08:29:32 +0200 Subject: [PATCH 24/47] script: advanced_menu.sh, switch version becomes switch branch --- scripts/ui/advanced_menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index f3651dd..5dd55da 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -6,7 +6,7 @@ advanced_ui(){ hr echo -e "| | | " echo -e "| Klipper: | Mainsail: | " - echo -e "| 1) [Switch Version] | 7) [Theme installer] | " + echo -e "| 1) [Switch Branch] | 7) [Theme installer] | " echo -e "| 2) [Rollback] | | " echo -e "| | System: | " echo -e "| Firmware: | 8) [Change hostname] | " From 54089582e4a57cf1cbe2d745c2c2e33670a1bdbe Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 13 Jun 2021 10:45:37 +0200 Subject: [PATCH 25/47] script: rewrite the auto mainsailOS/fluiddPi migration function No auto update anymore when updating Klipper. The user now must start this function. It's available in the Advanced Menu. --- scripts/ui/advanced_menu.sh | 41 +++++++++++++ scripts/update.sh | 116 ++++++++++++++++++++++++++++-------- 2 files changed, 131 insertions(+), 26 deletions(-) diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index 5dd55da..05602c2 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -14,6 +14,8 @@ advanced_ui(){ echo -e "| 4) [Build + Flash] | Extensions: | " echo -e "| 5) [Build + SD Flash] | 9) [Shell Command] | " echo -e "| 6) [Get MCU ID] | | " + echo -e "| | CustomPiOS: | " + echo -e "| | 10) [Migration Helper] | " quit_footer } @@ -66,6 +68,8 @@ advanced_menu(){ advanced_ui;; 9) do_action "setup_gcode_shell_command" "advanced_ui";; + 10) + do_action "migration_menu";; Q|q) clear; main_menu; break;; *) @@ -163,3 +167,40 @@ rollback_ui(){ echo -e "| $PREV_UI | " quit_footer } + +############################################################# +############################################################# + +migration_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~ [ CustomPiOS Migration ] ~~~~~~~~~~") | " + hr + echo -e "| This function will help you to migrate a vanilla | " + echo -e "| MainsailOS or FluiddPi image to a newer state. | " + blank_line + echo -e "| Only use this function if you use MainsailOS 0.4.0 | " + echo -e "| or lower, or FluiddPi v1.13.0 or lower. | " + blank_line + echo -e "| Please have a look at the KIAUH changelog for more | " + echo -e "| details on what this function will do. | " + hr + echo -e "| | " + echo -e "| 1) [Migrate MainsailOS] | " + echo -e "| 2) [Migrate FluiddPi] | " + echo -e "| | " + quit_footer +} + +migration_menu(){ + print_msg && clear_msg + migration_ui + while true; do + read -p "${cyan}Perform action:${default} " action; echo + case "$action" in + 1) migrate_custompios "mainsail"; migration_menu;; + 2) migrate_custompios "fluiddpi"; migration_menu;; + Q|q) clear; advanced_menu; break;; + *) print_unkown_cmd; migration_menu;; + esac + done +} \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 1a26aa0..f8d1506 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -99,40 +99,106 @@ update_log_paths(){ } migrate_custompios(){ - ### migrate vanilla mainsailOS 0.4.0 and fluiddPI v1.13.0 - ### and older to be in sync with their newer releases + ### migrate vanilla mainsailOS 0.4.0 / fluiddPI v1.13.0 + ### and older to be in sync with newer releases + WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" + MJPG_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/etc/systemd/system/webcamd.service" + KL_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/klipper/filesystem/root/etc/systemd/system/klipper.service" + NGINX_CFG1="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mainsail/filesystem/root/etc/nginx/conf.d/upstreams.conf" + NGINX_CFG2="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail" + LOG_ROTATE_KLIPPER="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/klipper/filesystem/root/etc/logrotate.d/klipper" + LOG_ROTATE_MOONRAKER="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/moonraker/filesystem/root/etc/logrotate.d/moonraker" + LOG_ROTATE_WEBCAMD="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/etc/logrotate.d/webcamd" + + if [ "$1" == "mainsail" ]; then + OS_VER="MainsailOS" + MACRO_CFG="mainsail.cfg" + fi + if [ "$1" == "fluiddpi" ]; then + OS_VER="FluiddPi" + MACRO_CFG="client_macros.cfg" + fi + if [ ! -f "/boot/$1.txt" ] || [ ! -f "/etc/init.d/klipper" ]; then + # abort function if there is no sign of an old CustomPiOS anymore + ERROR_MSG="No vanilla $OS_VER found. Aborting..." && return 0 + fi + status_msg "Starting migration of $OS_VER... Please wait..." + if [ -d "${HOME}/klipper_logs" ]; then + # delete an existing klipper_logs directory + # shouldn't be there in the first place if its a true vanilla CustomPiOS + status_msg "Recreate '~/klipper_logs' directory..." + rm -rf "${HOME}/klipper_logs" && mkdir "${HOME}/klipper_logs" + ok_msg "OK!" + fi if [ -f "/boot/$1.txt" ]; then - status_msg "Starting migration... Please wait..." - ### migrate webcam related stuff - WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd" - MJPG_SERV_SRC="${SRCDIR}/kiauh/resources/webcamd.service" - MJPG_SERV_TARGET="$SYSTEMDDIR/webcamd.service" - KL_SERV_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/klipper/filesystem/root/etc/systemd/system/klipper.service" - # stop webcam service - sudo systemctl stop webcamd.service - # replace old webcamd.service - sudo rm -f "$SYSTEMDDIR/webcamd.service" - # replace old webcamd + # replace old webcamd.service and webcamd + status_msg "Migrating MJPG-Streamer..." + sudo systemctl stop webcamd + sudo rm -f "/etc/systemd/system/webcamd.service" sudo rm -f "/root/bin/webcamd" - sudo cp $MJPG_SERV_SRC $MJPG_SERV_TARGET - sudo sed -i "s|%USER%|pi|" $MJPG_SERV_TARGET sudo wget $WEBCAMD_SRC -O "/usr/local/bin/webcamd" - sudo chmod +x /usr/local/bin/webcamd - # copy mainsail.txt or fluidd.txt to klipper_config and rename it + sudo wget $MJPG_SERV_SRC -O "/etc/systemd/system/webcamd.service" + sudo sed -i "s/MainsailOS/$OS_VER/" "/etc/systemd/system/webcamd.service" + sudo chmod +x "/usr/local/bin/webcamd" + # move mainsail.txt/fluiddpi.txt from boot to klipper_config and rename it sudo mv "/boot/$1.txt" "${HOME}/klipper_config/webcam.txt" sudo chown pi:pi "${HOME}/klipper_config/webcam.txt" - ### migrate klipper related stuff - sudo service klipper stop - # stop and remove init.d klipper service + sudo systemctl daemon-reload + sudo systemctl restart webcamd + ok_msg "OK!" + fi + if [ -f "/etc/init.d/klipper" ] && [ ! -f "/etc/systemd/system/klipper.service" ]; then + # replace klipper SysVinit service with systemd service + status_msg "Migrating Klipper Service..." + sudo systemctl stop klipper sudo update-rc.d -f klipper remove - sudo rm -f /etc/init.d/klipper - sudo rm -f /etc/default/klipper - # create new systemd service + sudo rm -f "/etc/init.d/klipper" + sudo rm -f "/etc/default/klipper" sudo wget $KL_SERV_SRC -O "/etc/systemd/system/klipper.service" sudo systemctl enable klipper.service sudo systemctl daemon-reload - ok_msg "Migration complete!" + sudo systemctl restart klipper + ok_msg "OK!" fi + if [ -f "/etc/systemd/system/moonraker.service" ]; then + # update new log path in existing moonraker service + status_msg "Updating Moonraker Service..." + sudo systemctl stop moonraker + update_log_paths "moonraker" + sudo systemctl restart moonraker + ok_msg "OK!" + fi + if [ -f "/etc/nginx/conf.d/upstreams.conf" ]; then + [ "$1" == "mainsail" ] && cfg="mainsail" + [ "$1" == "fluiddpi" ] && cfg="fluidd" + # update nginx upstreams.conf and mainsail/fluidd config file + status_msg "Updating NGINX configurations..." + sudo systemctl stop nginx + sudo rm -f "/etc/nginx/conf.d/upstreams.conf" + sudo rm -f "/etc/nginx/sites-available/$cfg" + sudo wget $NGINX_CFG1 -O "/etc/nginx/conf.d/upstreams.conf" + sudo wget $NGINX_CFG2 -O "/etc/nginx/sites-available/$cfg" + sudo sed -i "s/mainsail/$cfg/g" "/etc/nginx/sites-available/$cfg" + sudo systemctl restart nginx + ok_msg "OK!" + fi + if [ -f "${HOME}/klipper_config/$MACRO_CFG" ]; then + # update macro files + status_msg "Updating $MACRO_CFG ..." + MACRO_CFG_PATH="${HOME}/klipper_config/$MACRO_CFG" + sed -i "/SAVE_GCODE_STATE NAME=PAUSE_state/d" $MACRO_CFG_PATH + sed -i "/RESTORE_GCODE_STATE NAME=PAUSE_state/d" $MACRO_CFG_PATH + ok_msg "OK!" + fi + if [ -d "/etc/logrotate.d" ]; then + # download logrotate configs + status_msg "Setting up logrotations..." + sudo wget $LOG_ROTATE_KLIPPER -O "/etc/logrotate.d/klipper" + sudo wget $LOG_ROTATE_MOONRAKER -O "/etc/logrotate.d/moonraker" + sudo wget $LOG_ROTATE_WEBCAMD -O "/etc/logrotate.d/webcamd" + ok_msg "OK!" + fi + ok_msg "Migration done!" } update_klipper(){ @@ -172,8 +238,6 @@ update_klipper(){ ok_msg "Dependencies have been installed!" fi fi - migrate_custompios "mainsail" - migrate_custompios "fluiddpi" update_log_paths "klipper" ok_msg "Update complete!" klipper_service "restart" From 72312422e3294867d1054a3bada9bd7023ad3a22 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 13 Jun 2021 11:59:12 +0200 Subject: [PATCH 26/47] fix: performance improvement for loading the advanced menu ui --- scripts/functions.sh | 3 +++ scripts/ui/advanced_menu.sh | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 455ebe5..2817126 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -248,6 +248,9 @@ toggle_octoprint_service(){ read_octoprint_service_status(){ unset OPRINT_SERVICE_STATUS + if [ ! -f "/etc/systemd/system/octoprint.service" ]; then + return 0 + fi if systemctl list-unit-files | grep -E "octoprint*" | grep "enabled" &>/dev/null; then OPRINT_SERVICE_STATUS="${red}[Disable]${default} OctoPrint Service " else diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index 05602c2..01dc2b0 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -2,9 +2,11 @@ advanced_ui(){ top_border echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${default} | " hr - echo -e "| 0) $OPRINT_SERVICE_STATUS| " - hr - echo -e "| | | " + if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then + echo -e "| 0) $OPRINT_SERVICE_STATUS| " + hr + echo -e "| | | " + fi echo -e "| Klipper: | Mainsail: | " echo -e "| 1) [Switch Branch] | 7) [Theme installer] | " echo -e "| 2) [Rollback] | | " From 3ebee823add3bfe9fe692f3430662c001ce47ada Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 15 Jun 2021 16:12:58 +0200 Subject: [PATCH 27/47] script: remove KlipperScreen.log symlink dialog. --- scripts/install_klipperscreen.sh | 52 ++------------------------------ 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/scripts/install_klipperscreen.sh b/scripts/install_klipperscreen.sh index 80c7d0c..a9262de 100755 --- a/scripts/install_klipperscreen.sh +++ b/scripts/install_klipperscreen.sh @@ -2,13 +2,8 @@ install_klipperscreen(){ python3_check if [ $py_chk_ok = "true" ]; then source_kiauh_ini - system_check_klipperscreen - #ask user for customization - get_user_selections_klipperscreen #KlipperScreen main installation klipperscreen_setup - #execute customizations - symlinks_klipperscreen #after install actions restart_klipperscreen else @@ -29,57 +24,16 @@ python3_check(){ fi } -system_check_klipperscreen(){ - source_kiauh_ini - if [ ! -e $klipper_cfg_loc/KlipperScreen.log ]; then - KLIPPERSCREEN_SL_FOUND="false" - else - KLIPPERSCREEN_SL_FOUND="true" - fi -} - -get_user_selections_klipperscreen(){ - #user selection for KlipperScreen.log symlink - if [ "$KLIPPERSCREEN_SL_FOUND" = "false" ]; then - while true; do - echo - read -p "${cyan}###### Create KlipperScreen.log symlink? (y/N):${default} " yn - case "$yn" in - Y|y|Yes|yes) - echo -e "###### > Yes" - SEL_KSLOG_SL="true" - break;; - N|n|No|no|"") - echo -e "###### > No" - SEL_KSLOG_SL="false" - break;; - *) - print_unkown_cmd - print_msg && clear_msg;; - esac - done - fi -} - klipperscreen_setup(){ dep=(wget curl unzip dfu-util) dependency_check status_msg "Downloading KlipperScreen ..." - #force remove existing KlipperScreen dir + # force remove existing KlipperScreen dir [ -d $KLIPPERSCREEN_DIR ] && rm -rf $KLIPPERSCREEN_DIR - #clone into fresh KlipperScreen dir + # clone into fresh KlipperScreen dir cd ${HOME} && git clone $KLIPPERSCREEN_REPO ok_msg "Download complete!" status_msg "Installing KlipperScreen ..." $KLIPPERSCREEN_DIR/scripts/KlipperScreen-install.sh - echo; ok_msg "KlipperScreen successfully installed!" -} - -symlinks_klipperscreen(){ - #create a KlipperScreen.log symlink in klipper_config-dir just for convenience - if [ "$SEL_KSLOG_SL" = "true" ] && [ ! -e $klipper_cfg_loc/KlipperScreen.log ]; then - status_msg "Creating KlipperScreen.log symlink ..." - ln -s /tmp/KlipperScreen.log $klipper_cfg_loc - ok_msg "Symlink created!" - fi + ok_msg "KlipperScreen successfully installed!" } From 412e084d6d21801a13ef72e52510c904b13840f1 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 15 Jun 2021 16:40:10 +0200 Subject: [PATCH 28/47] script: add short changelog url to kiauh update message --- scripts/ui/general_ui.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ui/general_ui.sh b/scripts/ui/general_ui.sh index 47c55d7..f34d37a 100755 --- a/scripts/ui/general_ui.sh +++ b/scripts/ui/general_ui.sh @@ -33,6 +33,8 @@ kiauh_update_msg(){ top_border echo -e "|${green} New KIAUH update available! ${default}| " hr + echo -e "|${green} View Changelog: https://git.io/JnmlX ${default}| " + blank_line echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${default}| " echo -e "|${yellow} usually contain bugfixes, important changes or new ${default}| " echo -e "|${yellow} features. Please consider updating! ${default}| " From e9706b52d8c91e9a8d4898119ccba6dd80ad6baa Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 15 Jun 2021 17:22:39 +0200 Subject: [PATCH 29/47] Update changelog.md --- docs/changelog.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 598fe60..7571c9e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,35 @@ This document covers possible important changes to KIAUH. +### 2021-06-15 + +* Moonraker introduced an optional `log_path` which clients can make use of to show log files located in that folder to their users. More info here: https://github.com/Arksine/moonraker/commit/829b3a4ee80579af35dd64a37ccc092a1f67682a \ +Client developers agreed upon using `~/klipper_logs` as the new default log path.\ +That means, from now on, Klipper and Moonraker services installed with KIAUH will place their logfiles in that mentioned folder. +* Additionally, KIAUH will now detect Klipper and Moonraker systemd services that still use the old default location of `/tmp/.log` and will update them next time the user updates Klipper and/or Moonraker with the KIAUH update function. +* Additional symlinks for the following logfiles will get created along those update procedures to make them accessible through the webinterface once its supported: + - webcamd.log + - mainsail-access.log + - mainsail-error.log + - fluidd-access.log + - fluidd-error.log +* For MainsailOS and FluiddPi users:\ +MainsailOS and FluiddPi will switch the shipped Klipper service from SysVinit to systemd probably with their next release. KIAUH can already help migrate older MainsailOS (0.4.0 and below) and FluiddPi (v1.13.0) releases to match their new service-, file- and folder-structure so you don't have to re-flash the SD-Card of your Raspberry Pi.\ +In detail here is what is going to happen when you use the new "CustomPiOS Migration Helper" from the Advanced Menu `(Main Menu -> 4 -> Enter -> 10 -> Enter)` in a short summary: + 1) The Klipper SysVinit service will get replaced by a Klipper systemd service + 2) Klipper and Moonraker will use the new log-directory `~/klipper_logs` + 3) The webcamd service gets updated + 4) The webcamd script gets updated and moved from `/root/bin/webcamd` to `/usr/local/bin/webcamd` + 5) The NGINX `upstreams.conf` gets updated to be able to configure up to 4 webcams + 6) The `mainsail.txt` / `fluiddpi.txt` gets moved from `/boot` to `~/klipper_config` and renamed to `webcam.txt` + 7) Symlinks for the webcamd.log and various NGINX logs get created in `~/klipper_config` + 8) Configuration files for Klipper, Moonraker and webcamd get added to `/etc/logrotate.d` + 9) If they still exist, two lines will be removed from the mainsail.cfg or client_macros.cfg macro configurations:\ + `SAVE_GCODE_STATE NAME=PAUSE_state` and + `RESTORE_GCODE_STATE NAME=PAUSE_state`\ +* **Please note:**\ +The "CustomPiOS Migration Helper" is intended to only work on "vanilla" MainsailOS and FluiddPi systems. Do not try to migrate a modified MainsailOS or FluiddPi system (for example if you already used KIAUH to re-install services or to set up a multi-instance installation for Klipper / Moonraker). This won't work. + ### 2021-01-31 * **This is a big one... KIAUH v3.0 is out.**\ From 806c6fd275140fedb468839994700574070a79c0 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 15 Jun 2021 17:36:08 +0200 Subject: [PATCH 30/47] Update changelog.md --- docs/changelog.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 7571c9e..b9e6107 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -16,18 +16,18 @@ That means, from now on, Klipper and Moonraker services installed with KIAUH wil - fluidd-error.log * For MainsailOS and FluiddPi users:\ MainsailOS and FluiddPi will switch the shipped Klipper service from SysVinit to systemd probably with their next release. KIAUH can already help migrate older MainsailOS (0.4.0 and below) and FluiddPi (v1.13.0) releases to match their new service-, file- and folder-structure so you don't have to re-flash the SD-Card of your Raspberry Pi.\ -In detail here is what is going to happen when you use the new "CustomPiOS Migration Helper" from the Advanced Menu `(Main Menu -> 4 -> Enter -> 10 -> Enter)` in a short summary: - 1) The Klipper SysVinit service will get replaced by a Klipper systemd service - 2) Klipper and Moonraker will use the new log-directory `~/klipper_logs` - 3) The webcamd service gets updated - 4) The webcamd script gets updated and moved from `/root/bin/webcamd` to `/usr/local/bin/webcamd` - 5) The NGINX `upstreams.conf` gets updated to be able to configure up to 4 webcams - 6) The `mainsail.txt` / `fluiddpi.txt` gets moved from `/boot` to `~/klipper_config` and renamed to `webcam.txt` - 7) Symlinks for the webcamd.log and various NGINX logs get created in `~/klipper_config` - 8) Configuration files for Klipper, Moonraker and webcamd get added to `/etc/logrotate.d` - 9) If they still exist, two lines will be removed from the mainsail.cfg or client_macros.cfg macro configurations:\ - `SAVE_GCODE_STATE NAME=PAUSE_state` and - `RESTORE_GCODE_STATE NAME=PAUSE_state`\ +In detail here is what is going to happen when you use the new "CustomPiOS Migration Helper" from the Advanced Menu\ +`(Main Menu -> 4 -> Enter -> 10 -> Enter)` in a short summary: + * The Klipper SysVinit service will get replaced by a Klipper systemd service + * Klipper and Moonraker will use the new log-directory `~/klipper_logs` + * The webcamd service gets updated + * The webcamd script gets updated and moved from `/root/bin/webcamd` to `/usr/local/bin/webcamd` + * The NGINX `upstreams.conf` gets updated to be able to configure up to 4 webcams + * The `mainsail.txt` / `fluiddpi.txt` gets moved from `/boot` to `~/klipper_config` and renamed to `webcam.txt` + * Symlinks for the webcamd.log and various NGINX logs get created in `~/klipper_config` + * Configuration files for Klipper, Moonraker and webcamd get added to `/etc/logrotate.d` + * If they still exist, two lines will be removed from the mainsail.cfg or client_macros.cfg macro configurations:\ + `SAVE_GCODE_STATE NAME=PAUSE_state` and `RESTORE_GCODE_STATE NAME=PAUSE_state` * **Please note:**\ The "CustomPiOS Migration Helper" is intended to only work on "vanilla" MainsailOS and FluiddPi systems. Do not try to migrate a modified MainsailOS or FluiddPi system (for example if you already used KIAUH to re-install services or to set up a multi-instance installation for Klipper / Moonraker). This won't work. From 40875dfe49da43e6ebf6a46bcf2ffdc53d34c8ba Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 18 Jun 2021 18:03:47 +0200 Subject: [PATCH 31/47] script: simplify service action methods --- scripts/functions.sh | 104 +++++++------------------------ scripts/install_klipper.sh | 8 +-- scripts/install_klipper_webui.sh | 2 +- scripts/install_moonraker.sh | 4 +- scripts/ui/main_menu.sh | 60 ++++++------------ scripts/update.sh | 12 ++-- 6 files changed, 54 insertions(+), 136 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 2817126..2713635 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -82,7 +82,8 @@ change_klipper_cfg_path(){ set_klipper_cfg_path(){ ### stop services - klipper_service "stop" && moonraker_service "stop" + do_action_service "stop" "klipper" + do_action_service "stop" "moonraker" ### copy config files to new klipper config folder if [ ! -z "$old_klipper_cfg_loc" ] && [ -d "$old_klipper_cfg_loc" ]; then @@ -137,77 +138,17 @@ set_klipper_cfg_path(){ sudo systemctl daemon-reload ### restart services - klipper_service "restart" && moonraker_service "restart" + do_action_service "restart" "klipper" + do_action_service "restart" "moonraker" } source_kiauh_ini(){ source $INI_FILE } -klipper_service(){ - ### set a variable for the ok and status messages - [ "$1" == "start" ] && ACTION1="started" && ACTION2="Starting" - [ "$1" == "stop" ] && ACTION1="stopped" && ACTION2="Stopping" - [ "$1" == "restart" ] && ACTION1="restarted" && ACTION2="Restarting" - - if ls /etc/systemd/system/klipper-*.service 2>/dev/null 1>&2; then - INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service" | wc -l) - INSTANCE=1 - status_msg "$ACTION2 $INSTANCE_COUNT Klipper Services ..." - while [ $INSTANCE -le $INSTANCE_COUNT ]; do - sudo systemctl $1 klipper-$INSTANCE && ok_msg "Klipper Service #$INSTANCE $ACTION1!" - ### instance counter +1 - INSTANCE=$(expr $INSTANCE + 1) - done - elif [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper.service")" ]; then - status_msg "$ACTION2 Klipper Service ..." - sudo systemctl $1 klipper && ok_msg "Klipper Service $ACTION1!" - fi -} - -moonraker_service(){ - ### set a variable for the ok and status messages - [ "$1" == "start" ] && ACTION1="started" && ACTION2="Starting" - [ "$1" == "stop" ] && ACTION1="stopped" && ACTION2="Stopping" - [ "$1" == "restart" ] && ACTION1="restarted" && ACTION2="Restarting" - - if ls /etc/systemd/system/moonraker-*.service 2>/dev/null 1>&2; then - INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "moonraker-[[:digit:]].service" | wc -l) - INSTANCE=1 - status_msg "$ACTION2 $INSTANCE_COUNT Moonraker Services ..." - while [ $INSTANCE -le $INSTANCE_COUNT ]; do - sudo systemctl $1 moonraker-$INSTANCE && ok_msg "Moonraker Service #$INSTANCE $ACTION1!" - ### instance counter +1 - INSTANCE=$(expr $INSTANCE + 1) - done - elif [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "moonraker.service")" ]; then - status_msg "$ACTION2 Moonraker Service ..." - sudo systemctl $1 moonraker && ok_msg "Moonraker Service $ACTION1!" - fi -} - -dwc_service(){ - ### set a variable for the ok and status messages - [ "$1" == "start" ] && ACTION1="started" && ACTION2="Starting" - [ "$1" == "stop" ] && ACTION1="stopped" && ACTION2="Stopping" - [ "$1" == "restart" ] && ACTION1="restarted" && ACTION2="Restarting" - - if ls /etc/systemd/system/dwc-*.service 2>/dev/null 1>&2; then - INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "dwc-[[:digit:]].service" | wc -l) - INSTANCE=1 - status_msg "$ACTION2 $INSTANCE_COUNT DWC-for-Klipper-Socket Services ..." - while [ $INSTANCE -le $INSTANCE_COUNT ]; do - sudo systemctl $1 dwc-$INSTANCE && ok_msg "DWC-for-Klipper-Socket Service #$INSTANCE $ACTION1!" - ### instance counter +1 - INSTANCE=$(expr $INSTANCE + 1) - done - elif [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "dwc.service")" ]; then - status_msg "$ACTION2 DWC-for-Klipper-Socket Service ..." - sudo systemctl $1 dwc && ok_msg "DWC-for-Klipper-Socket Service $ACTION1!" - fi -} - -octoprint_service(){ +do_action_service(){ + shopt -s extglob # enable extended globbing + SERVICES="$SYSTEMDDIR/$2?(-*([0-9])).service" ### set a variable for the ok and status messages [ "$1" == "start" ] && ACTION1="started" && ACTION2="Starting" [ "$1" == "stop" ] && ACTION1="stopped" && ACTION2="Stopping" @@ -215,30 +156,27 @@ octoprint_service(){ [ "$1" == "enable" ] && ACTION1="enabled" && ACTION2="Enabling" [ "$1" == "disable" ] && ACTION1="disabled" && ACTION2="Disabling" - if ls /etc/systemd/system/octoprint-*.service 2>/dev/null 1>&2; then - INSTANCE=1 - INSTANCE_COUNT=$(systemctl list-unit-files | grep -E "octoprint.*" | wc -l) - status_msg "$ACTION2 $INSTANCE_COUNT OctoPrint Services ..." - while [ $INSTANCE -le $INSTANCE_COUNT ]; do - sudo systemctl $1 octoprint-$INSTANCE && ok_msg "OctoPrint Service #$INSTANCE $ACTION1!" - ### instance counter +1 - INSTANCE=$(expr $INSTANCE + 1) + if ls $SERVICES 2>/dev/null 1>&2; then + for service in $(ls $SERVICES | rev | cut -d"/" -f1 | rev); do + status_msg "$ACTION2 $service ..." + sudo systemctl $1 "$service" + ok_msg "$service $ACTION1!" done - elif [ "$(systemctl list-unit-files | grep -E "octoprint.*")" ]; then - status_msg "$ACTION2 OctoPrint Service ..." - sudo systemctl $1 octoprint && ok_msg "OctoPrint Service $ACTION1!" + else + ERROR_MSG="Service '$2' not found!" && print_msg && clear_msg fi + shopt -u extglob # disable extended globbing } toggle_octoprint_service(){ if systemctl list-unit-files | grep -E "octoprint.*" | grep "enabled" &>/dev/null; then - octoprint_service "stop" - octoprint_service "disable" + do_action_service "stop" "octoprint" + do_action_service "disable" "octoprint" sleep 2 CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" elif systemctl list-unit-files | grep -E "octoprint.*" | grep "disabled" &>/dev/null; then - octoprint_service "enable" - octoprint_service "start" + do_action_service "enable" "octoprint" + do_action_service "start" "octoprint" sleep 2 CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" else @@ -370,7 +308,7 @@ setup_gcode_shell_command(){ } install_gcode_shell_command(){ - klipper_service "stop" + do_action_service "stop" "klipper" status_msg "Copy 'gcode_shell_command.py' to '$KLIPPER_DIR/klippy/extras' ..." cp ${SRCDIR}/kiauh/resources/gcode_shell_command.py $KLIPPER_DIR/klippy/extras while true; do @@ -412,7 +350,7 @@ install_gcode_shell_command(){ esac done ok_msg "Shell command extension installed!" - klipper_service "restart" + do_action_service "restart" "klipper" } create_minimal_cfg(){ diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index ce63d43..d3af6d5 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -286,18 +286,18 @@ select_mcu_id(){ } flash_mcu(){ - klipper_service "stop" + do_action_service "stop" "klipper" if ! make flash FLASH_DEVICE="${mcu_list[$mcu_index]}" ; then warn_msg "Flashing failed!" warn_msg "Please read the console output above!" else ok_msg "Flashing successfull!" fi - klipper_service "start" + do_action_service "start" "klipper" } flash_mcu_sd(){ - klipper_service "stop" + do_action_service "stop" "klipper" ### write each supported board to the array to make it selectable board_list=() @@ -362,7 +362,7 @@ flash_mcu_sd(){ ok_msg "Flashing successfull!" fi - klipper_service "start" + do_action_service "start" "klipper" } build_fw(){ diff --git a/scripts/install_klipper_webui.sh b/scripts/install_klipper_webui.sh index e949cf9..ea1fa84 100755 --- a/scripts/install_klipper_webui.sh +++ b/scripts/install_klipper_webui.sh @@ -163,7 +163,7 @@ install_kiauh_macros(){ ok_msg "$klipper_cfg_loc/kiauh_macros.cfg created!" fi ### restart klipper service to parse the modified printer.cfg - klipper_service "restart" + do_action_service "restart" "klipper" fi } diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 6abe1fd..911b6b1 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -352,9 +352,9 @@ process_octoprint_dialog(){ Y|y|Yes|yes|"") echo -e "###### > Yes" status_msg "Stopping OctoPrint ..." - octoprint_service "stop" && ok_msg "OctoPrint service stopped!" + do_action_service "stop" "octoprint" && ok_msg "OctoPrint service stopped!" status_msg "Disabling OctoPrint ..." - octoprint_service "disable" && ok_msg "OctoPrint service disabled!" + do_action_service "disable" "octoprint" && ok_msg "OctoPrint service disabled!" break;; N|n|No|no) echo -e "###### > No" diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index cd26827..e279ac4 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -59,46 +59,26 @@ main_menu(){ while true; do read -p "${cyan}Perform action:${default} " action; echo case "$action" in - "start klipper") - do_action "klipper_service start" "main_ui";; - "stop klipper") - do_action "klipper_service stop" "main_ui";; - "restart klipper") - do_action "klipper_service restart" "main_ui";; - "start moonraker") - do_action "moonraker_service start" "main_ui";; - "stop moonraker") - do_action "moonraker_service stop" "main_ui";; - "restart moonraker") - do_action "moonraker_service restart" "main_ui";; - "start dwc") - do_action "dwc_service start" "main_ui";; - "stop dwc") - do_action "dwc_service stop" "main_ui";; - "restart dwc") - do_action "dwc_service restart" "main_ui";; - "start octoprint") - do_action "octoprint_service start" "main_ui";; - "stop octoprint") - do_action "octoprint_service stop" "main_ui";; - "restart octoprint") - do_action "octoprint_service restart" "main_ui";; - update) - do_action "update_kiauh" "main_ui";; - 0) - do_action "upload_selection" "main_ui";; - 1) - clear && install_menu && break;; - 2) - clear && update_menu && break;; - 3) - clear && remove_menu && break;; - 4) - clear && advanced_menu && break;; - 5) - clear && backup_menu && break;; - 6) - clear && settings_menu && break;; + "start klipper") do_action_service "start" "klipper"; main_ui;; + "stop klipper") do_action_service "stop" "klipper"; main_ui;; + "restart klipper") do_action_service "restart" "klipper"; main_ui;; + "start moonraker") do_action_service "start" "moonraker"; main_ui;; + "stop moonraker") do_action_service "stop" "moonraker"; main_ui;; + "restart moonraker")do_action_service "restart" "moonraker"; main_ui;; + "start dwc") do_action_service "start" "dwc"; main_ui;; + "stop dwc") do_action_service "stop" "dwc"; main_ui;; + "restart dwc") do_action_service "restart" "dwc"; main_ui;; + "start octoprint") do_action_service "start" "octoprint"; main_ui;; + "stop octoprint") do_action_service "stop" "octoprint"; main_ui;; + "restart octoprint") do_action_service "restart" "octoprint"; main_ui;; + update) do_action "update_kiauh" "main_ui";; + 0) do_action "upload_selection" "main_ui";; + 1) clear && install_menu && break;; + 2) clear && update_menu && break;; + 3) clear && remove_menu && break;; + 4) clear && advanced_menu && break;; + 5) clear && backup_menu && break;; + 6) clear && settings_menu && break;; Q|q) echo -e "${green}###### Happy printing! ######${default}"; echo exit -1;; diff --git a/scripts/update.sh b/scripts/update.sh index f8d1506..a4d0bb0 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -202,7 +202,7 @@ migrate_custompios(){ } update_klipper(){ - klipper_service "stop" + do_action_service "stop" "klipper" if [ ! -d $KLIPPER_DIR ]; then cd ${HOME} && git clone $KLIPPER_REPO else @@ -240,18 +240,18 @@ update_klipper(){ fi update_log_paths "klipper" ok_msg "Update complete!" - klipper_service "restart" + do_action_service "restart" "klipper" } update_dwc2fk(){ - dwc_service "stop" + do_action_service "stop" "dwc" bb4u "dwc2" if [ ! -d $DWC2FK_DIR ]; then cd ${HOME} && git clone $DWC2FK_REPO else cd $DWC2FK_DIR && git pull fi - dwc_service "start" + do_action_service "start" "dwc" } update_dwc2(){ @@ -274,7 +274,7 @@ update_fluidd(){ } update_moonraker(){ - moonraker_service "stop" + do_action_service "stop" "moonraker" bb4u "moonraker" status_msg "Updating Moonraker ..." cd $MOONRAKER_DIR @@ -301,7 +301,7 @@ update_moonraker(){ fi update_log_paths "moonraker" ok_msg "Update complete!" - moonraker_service "restart" + do_action_service "restart" "moonraker" } update_klipperscreen(){ From 991dd79d01a9513ce651817e8deea7e351852b8e Mon Sep 17 00:00:00 2001 From: th33xitus Date: Fri, 18 Jun 2021 18:28:27 +0200 Subject: [PATCH 32/47] script: add simple check for DietPi distro when creating the klipper dependency array --- scripts/install_klipper.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index d3af6d5..aaaef20 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -56,7 +56,11 @@ install_klipper_packages(){ unset PKGARR for PKG in $PKGLIST; do PKGARR+=($PKG); done ### add dbus requirement for DietPi distro - PKGARR+=("dbus") + if [ -e "/boot/dietpi" ]; then + PKGARR+=("dbus") + fi + + ### display dependencies to user echo "${cyan}${PKGARR[@]}${default}" ### Update system package info From 814acbe92a3bbb46d1d8370f6e82fce700484ca1 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Mon, 21 Jun 2021 08:44:37 +0200 Subject: [PATCH 33/47] script: add `virtualenv` to the moonraker dependency check #95 --- scripts/install_moonraker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 911b6b1..4b095ef 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -107,7 +107,7 @@ moonraker_setup_dialog(){ moonraker_setup(){ ### checking dependencies - dep=(wget curl unzip dfu-util) + dep=(wget curl unzip dfu-util virtualenv) ### additional deps for kiauh compatibility for armbian dep+=(libjpeg-dev zlib1g-dev) dependency_check From a9f23e9b23578117dbf82241ddb6e8ea8975bd32 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Mon, 21 Jun 2021 20:43:01 +0200 Subject: [PATCH 34/47] script: remove else statement from do_action_service Caused spamming of error messages when starting from a complete new Pi image. --- scripts/functions.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 2713635..4424f0c 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -162,8 +162,6 @@ do_action_service(){ sudo systemctl $1 "$service" ok_msg "$service $ACTION1!" done - else - ERROR_MSG="Service '$2' not found!" && print_msg && clear_msg fi shopt -u extglob # disable extended globbing } From b47a9cf7eda0ac965f5eaadd69c127779ad3c65c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 22 Jun 2021 12:07:27 +0200 Subject: [PATCH 35/47] feat: add voron toolhead theme to mainsail theme installer --- scripts/ms_theme_installer.sh | 17 +++++++++++++++++ scripts/ui/ms_theme_menu.sh | 2 ++ 2 files changed, 19 insertions(+) diff --git a/scripts/ms_theme_installer.sh b/scripts/ms_theme_installer.sh index 30fad4c..0d30335 100755 --- a/scripts/ms_theme_installer.sh +++ b/scripts/ms_theme_installer.sh @@ -70,6 +70,23 @@ ms_theme_cyberpunk(){ [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" cd $THEME_PATH && git clone "$THEME_URL" ".theme" + ok_msg "Theme installation complete!" + ok_msg "Please remember to delete your browser cache!\n" +} + +ms_theme_voron_toolhead(){ + THEME_URL="https://github.com/eriroh/Mainsail-x-Voron-Toolhead-Theme" + + ### check and select printer if there is more than 1 + check_select_printer + + ### download all files + status_msg "Installing Mainsail x Voron Toolhead theme ..." + status_msg "Please wait ..." + + [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" + cd $THEME_PATH && git clone "$THEME_URL" ".theme" + ok_msg "Theme installation complete!" ok_msg "Please remember to delete your browser cache!\n" } \ No newline at end of file diff --git a/scripts/ui/ms_theme_menu.sh b/scripts/ui/ms_theme_menu.sh index 79816d0..43330c7 100755 --- a/scripts/ui/ms_theme_menu.sh +++ b/scripts/ui/ms_theme_menu.sh @@ -9,6 +9,7 @@ ms_theme_ui(){ echo -e "| Theme: | " echo -e "| 1) [Dracula] | " echo -e "| 2) [Cyberpunk] | " + echo -e "| 3) [Voron Toolhead] | " echo -e "| | " echo -e "| R) [Remove Theme] | " echo -e "| | " @@ -22,6 +23,7 @@ ms_theme_menu(){ case "$action" in 1) do_action "ms_theme_dracula" "ms_theme_ui";; 2) do_action "ms_theme_cyberpunk" "ms_theme_ui";; + 3) do_action "ms_theme_voron_toolhead" "ms_theme_ui";; R|r) do_action "ms_theme_delete" "ms_theme_ui";; Q|q) clear; advanced_menu; break;; *) deny_action "ms_theme_ui";; From 47d13219793e5d86c839957db83209843e9af74d Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 22 Jun 2021 17:12:38 +0200 Subject: [PATCH 36/47] script: mainsail theme installer overhaul --- scripts/ms_theme_installer.sh | 127 ++++++++++++++++++++-------------- scripts/ui/ms_theme_menu.sh | 33 --------- 2 files changed, 76 insertions(+), 84 deletions(-) delete mode 100755 scripts/ui/ms_theme_menu.sh diff --git a/scripts/ms_theme_installer.sh b/scripts/ms_theme_installer.sh index 0d30335..bb08312 100755 --- a/scripts/ms_theme_installer.sh +++ b/scripts/ms_theme_installer.sh @@ -1,6 +1,64 @@ ### base variables SYSTEMDDIR="/etc/systemd/system" +get_theme_list(){ + theme_csv_url="https://raw.githubusercontent.com/meteyou/mainsail/cb874c1918f47f79441bd80decaa272fe8bae40f/docs/_data/themes.csv" + theme_csv=$(curl -s -L $theme_csv_url) + unset t_name + unset t_note + unset t_auth + unset t_url + i=0 + while IFS="," read -r col1 col2 col3 col4; do + t_name+=("$col1") + t_note+=("$col2") + t_auth+=("$col3") + t_url+=("$col4") + if [ ! "$col1" == "name" ]; then + printf "| $i) %-50s|\n" "[$col1]" + fi + let i++ + done <<< $theme_csv +} + +ms_theme_ui(){ + top_border + echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | " + hr + echo -e "| ${green}A preview of each Mainsail theme can be found here:${default} | " + echo -e "| https://docs.mainsail.xyz/theming/themes | " + blank_line + echo -e "| ${yellow}Important note:${default} | " + echo -e "| Installing a theme from this menu will overwrite an | " + echo -e "| already installed theme or modified custom.css file! | " + hr + #echo -e "| Theme: | " + # dynamically generate the themelist from a csv file + get_theme_list + echo -e "| | " + echo -e "| R) [Remove Theme] | " + #echo -e "| | " + quit_footer +} + +ms_theme_menu(){ + ms_theme_ui + while true; do + read -p "${cyan}Install theme:${default} " a; echo + if [ $a = "q" ] || [ $a = "Q" ]; then + clear && advanced_menu && break + elif [ $a -le ${#t_url[@]} ]; then + ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}" + ms_theme_menu + else + clear && print_header + ERROR_MSG="Invalid command!" && print_msg && clear_msg + ms_theme_menu + fi + done + ms_theme_menu +} + check_select_printer(){ unset printer_num @@ -27,6 +85,24 @@ check_select_printer(){ [ ! -d $THEME_PATH ] && mkdir -p $THEME_PATH } +ms_theme_install(){ + THEME_URL="https://github.com/$1/$2" + + ### check and select printer if there is more than 1 + check_select_printer + + ### download all files + status_msg "Installing $3 ..." + status_msg "Please wait ..." + + [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" + cd $THEME_PATH && git clone "$THEME_URL" ".theme" + + ok_msg "Theme installation complete!" + [ ! -z "$4" ] && echo "${yellow}###### Theme Info: $4${default}" + ok_msg "Please remember to delete your browser cache!\n" +} + ms_theme_delete(){ ### check and select printer if there is more than 1 check_select_printer @@ -38,55 +114,4 @@ ms_theme_delete(){ else status_msg "No Theme installed!\n" fi -} - -ms_theme_dracula(){ - THEME_URL="https://github.com/steadyjaw/dracula-mainsail-theme" - - ### check and select printer if there is more than 1 - check_select_printer - - ### download all files - status_msg "Installing Dracula theme ..." - status_msg "Please wait ..." - - [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" - cd $THEME_PATH && git clone "$THEME_URL" ".theme" - - ok_msg "Theme installation complete!" - ok_msg "Please remember to delete your browser cache!\n" -} - -ms_theme_cyberpunk(){ - THEME_URL="https://github.com/Dario-Ciceri/cp2077-mainsail-theme" - - ### check and select printer if there is more than 1 - check_select_printer - - ### download all files - status_msg "Installing Cyberpunk theme ..." - status_msg "Please wait ..." - - [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" - cd $THEME_PATH && git clone "$THEME_URL" ".theme" - - ok_msg "Theme installation complete!" - ok_msg "Please remember to delete your browser cache!\n" -} - -ms_theme_voron_toolhead(){ - THEME_URL="https://github.com/eriroh/Mainsail-x-Voron-Toolhead-Theme" - - ### check and select printer if there is more than 1 - check_select_printer - - ### download all files - status_msg "Installing Mainsail x Voron Toolhead theme ..." - status_msg "Please wait ..." - - [ -d "$THEME_PATH/.theme" ] && rm -rf "$THEME_PATH/.theme" - cd $THEME_PATH && git clone "$THEME_URL" ".theme" - - ok_msg "Theme installation complete!" - ok_msg "Please remember to delete your browser cache!\n" } \ No newline at end of file diff --git a/scripts/ui/ms_theme_menu.sh b/scripts/ui/ms_theme_menu.sh deleted file mode 100755 index 43330c7..0000000 --- a/scripts/ui/ms_theme_menu.sh +++ /dev/null @@ -1,33 +0,0 @@ -ms_theme_ui(){ - top_border - echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | " - hr - echo -e "| Please note: | " - echo -e "| Installing a theme from this menu will overwrite an | " - echo -e "| already installed theme or modified custom.css file! | " - hr - echo -e "| Theme: | " - echo -e "| 1) [Dracula] | " - echo -e "| 2) [Cyberpunk] | " - echo -e "| 3) [Voron Toolhead] | " - echo -e "| | " - echo -e "| R) [Remove Theme] | " - echo -e "| | " - quit_footer -} - -ms_theme_menu(){ - do_action "" "ms_theme_ui" - while true; do - read -p "${cyan}Perform action:${default} " action; echo - case "$action" in - 1) do_action "ms_theme_dracula" "ms_theme_ui";; - 2) do_action "ms_theme_cyberpunk" "ms_theme_ui";; - 3) do_action "ms_theme_voron_toolhead" "ms_theme_ui";; - R|r) do_action "ms_theme_delete" "ms_theme_ui";; - Q|q) clear; advanced_menu; break;; - *) deny_action "ms_theme_ui";; - esac - done - ms_theme_menu -} \ No newline at end of file From 5deb987b8a1fcbb339e2184a3d40d057714b621a Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 29 Jun 2021 22:58:21 +0200 Subject: [PATCH 37/47] script: patch `log_path` to moonraker.conf if missing --- docs/changelog.md | 3 +++ scripts/update.sh | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index b9e6107..f6cdd16 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,9 @@ This document covers possible important changes to KIAUH. +### 2021-06-29 +* KIAUH will now patch the new `log_path` to existing moonraker.conf files when updating Moonraker and the entry is missing. Before that, it was necessary that the user provided that path manually to make Fluidd display the logfiles in its interface. This issue should be resolved now. + ### 2021-06-15 * Moonraker introduced an optional `log_path` which clients can make use of to show log files located in that folder to their users. More info here: https://github.com/Arksine/moonraker/commit/829b3a4ee80579af35dd64a37ccc092a1f67682a \ diff --git a/scripts/update.sh b/scripts/update.sh index a4d0bb0..6bd11d1 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -66,6 +66,7 @@ update_log_paths(){ ### update services to make use of moonrakers new log_path option ### https://github.com/Arksine/moonraker/commit/829b3a4ee80579af35dd64a37ccc092a1f67682a shopt -s extglob # enable extended globbing + source_kiauh_ini LPATH="${HOME}/klipper_logs" [ ! -d "$LPATH" ] && mkdir -p "$LPATH" FILE="$SYSTEMDDIR/$1?(-*([0-9])).service" @@ -84,6 +85,17 @@ update_log_paths(){ done sudo systemctl daemon-reload + # patch log_path entry if not found + dir1="$klipper_cfg_loc" + dir2="$klipper_cfg_loc/printer_*" + for conf in $(find $dir1 $dir2 -name "moonraker.conf" 2> /dev/null); do + if ! grep -q "log_path" $conf; then + status_msg "Patching $conf" + sed -i "/^config_path/a log_path: $LPATH" $conf + ok_msg "OK!" + fi + done + # create symlink for mainsail and fluidd nginx logs symlink_webui_nginx_log "mainsail" symlink_webui_nginx_log "fluidd" From 765f016ea2d5600ba710593967f9513d032d1cf4 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 1 Jul 2021 21:38:14 +0200 Subject: [PATCH 38/47] fix: menu action for removing mainsail theme was missing --- scripts/ms_theme_installer.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ms_theme_installer.sh b/scripts/ms_theme_installer.sh index bb08312..568931d 100755 --- a/scripts/ms_theme_installer.sh +++ b/scripts/ms_theme_installer.sh @@ -47,6 +47,9 @@ ms_theme_menu(){ read -p "${cyan}Install theme:${default} " a; echo if [ $a = "q" ] || [ $a = "Q" ]; then clear && advanced_menu && break + elif [ $a = "r" ] || [ $a = "R" ]; then + ms_theme_delete + ms_theme_menu elif [ $a -le ${#t_url[@]} ]; then ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}" ms_theme_menu @@ -114,4 +117,4 @@ ms_theme_delete(){ else status_msg "No Theme installed!\n" fi -} \ No newline at end of file +} From d3726733e5bccf7791b4bd451ccf564da595879f Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 4 Jul 2021 20:09:25 +0200 Subject: [PATCH 39/47] fix: small flash routine rework + user input validation --- scripts/install_klipper.sh | 91 ++++++++++++++++++------------------- scripts/ui/advanced_menu.sh | 4 +- 2 files changed, 46 insertions(+), 49 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index aaaef20..2e08220 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -239,52 +239,55 @@ flash_routine_sd(){ select_mcu_id(){ if [ ${#mcu_list[@]} -ge 1 ]; then + echo top_border - echo -e "| ${red}!!! IMPORTANT WARNING !!!${default} |" + echo -e "| ${red}!!! ATTENTION !!!${default} |" hr - echo -e "| Make sure, that you select the correct ID for the MCU |" - echo -e "| you have build the firmware for in the previous step! |" - blank_line - echo -e "| This is especially important if you use different MCU |" - echo -e "| models which each require their own firmware! |" - blank_line + echo -e "| Make sure, to select the correct number for the MCU! |" echo -e "| ${red}ONLY flash a firmware created for the respective MCU!${default} |" bottom_border - + echo -e "${cyan}###### List of available MCU:${default}" ### list all mcus - i=1 + id=0 for mcu in ${mcu_list[@]}; do - echo -e "$i) ${cyan}$mcu${default}" - i=$(expr $i + 1) + let id++ + echo -e " $id) $mcu" done - while true; do + ### verify user input + sel_index="" + while [[ ! ($sel_index =~ ^[1-9]+$) ]] || [ $sel_index -gt $id ]; do echo - read -p "${cyan}###### Please select the ID for flashing:${default} " selected_index - mcu_index=$(echo $((selected_index - 1))) + read -p "${cyan}###### Select MCU to flash:${default} " sel_index + if [[ ! ($sel_index =~ ^[1-9]+$) ]]; then + warn_msg "Invalid input!" + elif [ $sel_index -lt 1 ] || [ $sel_index -gt $id ]; then + warn_msg "Please select a number between 1 and $id!" + fi + mcu_index=$(echo $((sel_index - 1))) selected_mcu_id="${mcu_list[$mcu_index]}" - echo -e "\nYou have selected to flash:\nโ— MCU #$selected_index: $selected_mcu_id\n" - while true; do - read -p "${cyan}###### Do you want to continue? (Y/n):${default} " yn - case "$yn" in - Y|y|Yes|yes|"") - echo -e "###### > Yes" - status_msg "Flashing $selected_mcu_id ..." - if [ "$FLASH_FIRMWARE" = "true" ]; then - flash_mcu - fi - if [ "$FLASH_FW_SD" = "true" ]; then - flash_mcu_sd - fi - break;; - N|n|No|no) - echo -e "###### > No" - break;; - *) - print_unkown_cmd - print_msg && clear_msg;; - esac - done - break + done + ### process flashing + while true; do + echo -e "\n###### You selected:\n โ— MCU #$sel_index: $selected_mcu_id\n" + read -p "${cyan}###### Continue? (Y/n):${default} " yn + case "$yn" in + Y|y|Yes|yes|"") + echo -e "###### > Yes" + status_msg "Flashing $selected_mcu_id ..." + if [ "$FLASH_FIRMWARE" = "true" ]; then + flash_mcu + fi + if [ "$FLASH_FW_SD" = "true" ]; then + flash_mcu_sd + fi + break;; + N|n|No|no) + echo -e "###### > No" + break;; + *) + print_unkown_cmd + print_msg && clear_msg;; + esac done fi } @@ -389,17 +392,11 @@ get_mcu_id(){ echo -e "| Please make sure your MCU is connected to the Pi! |" echo -e "| If the MCU is not connected yet, connect it now. |" bottom_border - while true; do - echo -e "${cyan}" - read -p "###### Press ENTER to continue ... " yn - echo -e "${default}" - case "$yn" in - *) - break;; - esac - done + echo -e "${cyan}" + read -p "###### Press ANY KEY to continue ... " -n 1 -r + echo -e "${default}" status_msg "Identifying the ID of your MCU ..." - sleep 2 + sleep 1 unset MCU_ID ### if there are devices found, continue, else show warn message if ls /dev/serial/by-id/* 2>/dev/null 1>&2; then diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index 01dc2b0..98ce539 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -44,7 +44,7 @@ advanced_menu(){ clear && print_header flash_routine if [ $FLASH_FIRMWARE = "true" ]; then - status_msg "Please wait..." && sleep 5 && build_fw + status_msg "Please wait..." && sleep 3 && build_fw select_mcu_id fi print_msg && clear_msg @@ -53,7 +53,7 @@ advanced_menu(){ clear && print_header flash_routine_sd if [ $FLASH_FW_SD = "true" ]; then - status_msg "Please wait..." && sleep 5 && build_fw + status_msg "Please wait..." && sleep 3 && build_fw select_mcu_id fi print_msg && clear_msg From 4d7e10e5c39262b68a02781941d813412eff0f63 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Jul 2021 09:22:43 +0200 Subject: [PATCH 40/47] script: update nginx configurations --- docs/changelog.md | 3 +++ resources/klipper_webui_nginx.cfg | 16 ++++++++++++++-- resources/upstreams.conf | 20 ++++++++++++++++---- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index f6cdd16..11f5bca 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,9 @@ This document covers possible important changes to KIAUH. +### 2021-07-10 +* The NGINX configuration files got updated to be in sync with MainsailOS and FluiddPi. Issues with the NGINX service not starting up due to wrong configuration should be resolved now. To get the updated configuration files, please remove Moonraker and Mainsail / Fluidd with KIAUH first and then re-install it. An automated file check for those configuration files might follow in the future which then automates updating those files if there were important changes. + ### 2021-06-29 * KIAUH will now patch the new `log_path` to existing moonraker.conf files when updating Moonraker and the entry is missing. Before that, it was necessary that the user provided that path manually to make Fluidd display the logfiles in its interface. This issue should be resolved now. diff --git a/resources/klipper_webui_nginx.cfg b/resources/klipper_webui_nginx.cfg index 18bc573..24c9abd 100644 --- a/resources/klipper_webui_nginx.cfg +++ b/resources/klipper_webui_nginx.cfg @@ -14,7 +14,7 @@ server { gzip_comp_level 4; gzip_buffers 16 8k; gzip_http_version 1.1; - gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml application/javascript; # web_path from <> static files root /home/pi/<>; @@ -56,6 +56,18 @@ server { } location /webcam/ { - proxy_pass http://mjpgstreamer/; + proxy_pass http://mjpgstreamer1/; + } + + location /webcam2/ { + proxy_pass http://mjpgstreamer2/; + } + + location /webcam3/ { + proxy_pass http://mjpgstreamer3/; + } + + location /webcam4/ { + proxy_pass http://mjpgstreamer4/; } } \ No newline at end of file diff --git a/resources/upstreams.conf b/resources/upstreams.conf index 4ecd9c6..d04e04a 100644 --- a/resources/upstreams.conf +++ b/resources/upstreams.conf @@ -1,13 +1,25 @@ # /etc/nginx/conf.d/upstreams.conf - upstream apiserver { - #edit your api port here ip_hash; server 127.0.0.1:7125; } -upstream mjpgstreamer { - #edit your webcam port here +upstream mjpgstreamer1 { ip_hash; server 127.0.0.1:8080; } + +upstream mjpgstreamer2 { + ip_hash; + server 127.0.0.1:8081; +} + +upstream mjpgstreamer3 { + ip_hash; + server 127.0.0.1:8082; +} + +upstream mjpgstreamer4 { + ip_hash; + server 127.0.0.1:8083; +} \ No newline at end of file From 52ab909ba5ecf647e4264613349fd47adc9c061e Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 10 Jul 2021 09:27:13 +0200 Subject: [PATCH 41/47] script: update moonraker.conf, apply recent changes to the update manager section --- docs/changelog.md | 2 ++ resources/moonraker.conf | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 11f5bca..abaa672 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,6 +5,8 @@ This document covers possible important changes to KIAUH. ### 2021-07-10 * The NGINX configuration files got updated to be in sync with MainsailOS and FluiddPi. Issues with the NGINX service not starting up due to wrong configuration should be resolved now. To get the updated configuration files, please remove Moonraker and Mainsail / Fluidd with KIAUH first and then re-install it. An automated file check for those configuration files might follow in the future which then automates updating those files if there were important changes. +* The default `moonraker.conf` was updated to reflect the recent changes to the update manager section. The update channel is set to `dev`. + ### 2021-06-29 * KIAUH will now patch the new `log_path` to existing moonraker.conf files when updating Moonraker and the entry is missing. Before that, it was necessary that the user provided that path manually to make Fluidd display the logfiles in its interface. This issue should be resolved now. diff --git a/resources/moonraker.conf b/resources/moonraker.conf index c77ac32..c8f9a10 100644 --- a/resources/moonraker.conf +++ b/resources/moonraker.conf @@ -24,18 +24,19 @@ cors_domains: [history] [update_manager] +channel: dev -[update_manager client mainsail] +[update_manager mainsail] type: web repo: meteyou/mainsail path: ~/mainsail -[update_manager client fluidd] +[update_manager fluidd] type: web repo: cadriel/fluidd path: ~/fluidd -#[update_manager client KlipperScreen] +#[update_manager KlipperScreen] #type: git_repo #path: /home/%USER%/KlipperScreen #origin: https://github.com/jordanruthe/KlipperScreen.git From b44e855a9851a6bf380c2ddf1bc750b295201d7c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 11 Jul 2021 14:45:58 +0200 Subject: [PATCH 42/47] script: simplify python dependency installation during klipper and moonraker update --- scripts/update.sh | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 6bd11d1..4dc8276 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -223,32 +223,17 @@ update_klipper(){ save_klipper_state status_msg "Updating $GET_BRANCH" cd $KLIPPER_DIR - if [ "$DETACHED_HEAD" == "true" ]; then git checkout $GET_BRANCH unset DETACHED_HEAD fi - - ### get current klippy-requirements.txt md5sum - KLIPPER_OLDREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)" ### pull latest files from github git pull ### read PKGLIST and install possible new dependencies install_klipper_packages - ### get possible new klippy-requirements.txt md5sum - KLIPPER_NEWREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)" - - ### check for possible new dependencies and install them - if [[ $KLIPPER_NEWREQ_MD5SUM != $KLIPPER_OLDREQ_MD5SUM ]]; then - PYTHONDIR="${HOME}/klippy-env" - status_msg "New dependecies detected..." - - ### always rebuild the pythondir from scratch if new dependencies were detected - rm -rf ${PYTHONDIR} - virtualenv -p python2 ${PYTHONDIR} - $PYTHONDIR/bin/pip install -r $KLIPPER_DIR/scripts/klippy-requirements.txt - ok_msg "Dependencies have been installed!" - fi + ### install possible new python dependencies + KLIPPER_REQ_TXT="$KLIPPER_DIR/scripts/klippy-requirements.txt" + $KLIPPY_ENV/bin/pip install -r $KLIPPER_REQ_TXT fi update_log_paths "klipper" ok_msg "Update complete!" @@ -289,28 +274,13 @@ update_moonraker(){ do_action_service "stop" "moonraker" bb4u "moonraker" status_msg "Updating Moonraker ..." - cd $MOONRAKER_DIR - - ### get current moonraker-requirements.txt md5sum - MOONRAKER_OLDREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) ### pull latest files from github - git pull + cd $MOONRAKER_DIR && git pull ### read PKGLIST and install possible new dependencies install_moonraker_packages - ### get possible new moonraker-requirements.txt md5sum - MOONRAKER_NEWREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) - - ### check for possible new dependencies and install them - if [[ $MOONRAKER_NEWREQ_MD5SUM != $MOONRAKER_OLDREQ_MD5SUM ]]; then - PYTHONDIR="${HOME}/moonraker-env" - status_msg "New dependecies detected..." - ### always rebuild the pythondir from scratch if new dependencies were detected - rm -rf ${PYTHONDIR} - virtualenv -p /usr/bin/python3 ${PYTHONDIR} - ln -s /usr/lib/python3/dist-packages/gpiod* ${PYTHONDIR}/lib/python*/site-packages - ${PYTHONDIR}/bin/pip install -r $MOONRAKER_DIR/scripts/moonraker-requirements.txt - ok_msg "Dependencies have been installed!" - fi + ### install possible new python dependencies + MR_REQ_TXT="$MOONRAKER_DIR/scripts/moonraker-requirements.txt" + $MOONRAKER_ENV/bin/pip install -r $MR_REQ_TXT update_log_paths "moonraker" ok_msg "Update complete!" do_action_service "restart" "moonraker" From 7984c28fe585dee4d4417e8313be8e036942e4af Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 11 Jul 2021 19:13:37 +0200 Subject: [PATCH 43/47] script: add more default trusted_clients to moonraker.conf template the previous method of adding the host network range was too unreliable in some cases and didn't cover some popular usecases --- resources/moonraker.conf | 8 ++++++-- scripts/install_moonraker.sh | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/resources/moonraker.conf b/resources/moonraker.conf index c8f9a10..6496655 100644 --- a/resources/moonraker.conf +++ b/resources/moonraker.conf @@ -9,10 +9,14 @@ klippy_uds_address: %UDS% [authorization] trusted_clients: - 127.0.0.1 %LAN% - ::1/128 + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 FE80::/10 + ::1/128 cors_domains: *.lan *.local diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 4b095ef..5a9f973 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -277,7 +277,13 @@ create_moonraker_conf(){ sed -i "s|%LOG%|$LOG_PATH|" $MR_CONF sed -i "s|%MR_DB%|$MR_DB|" $MR_CONF sed -i "s|%UDS%|$KLIPPY_UDS|" $MR_CONF - sed -i "s|%LAN%|$LAN|" $MR_CONF + # if host ip is not in the default ip ranges, replace placeholder + # otherwise remove placeholder from config + if ! grep $LAN $MR_CONF; then + sed -i "s|%LAN%|$LAN|" $MR_CONF + else + sed -i "/%LAN%/d" $MR_CONF + fi sed -i "s|%USER%|${USER}|g" $MR_CONF ok_msg "moonraker.conf created!" else From 39219c105e253e0a33ff0008c62ec0e52752d6ff Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 25 Jul 2021 18:42:22 +0200 Subject: [PATCH 44/47] script: add additional dependency check - should fix #97 Before starting the firmware building process, check for dependencies again. --- scripts/install_klipper.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 2e08220..316ca06 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -376,6 +376,8 @@ build_fw(){ if [ -d $KLIPPER_DIR ]; then cd $KLIPPER_DIR status_msg "Initializing firmware build ..." + dep=(build-essential dpkg-dev make) + dependency_check make clean make menuconfig status_msg "Building firmware ..." From 05842f8e1d2bcb4d03bf7d62467037a3a48602f9 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 10 Aug 2021 12:25:05 +0200 Subject: [PATCH 45/47] feat: add PrettyGCode for Klipper --- README.md | 6 +++++ docs/changelog.md | 3 +++ scripts/install_pgc_for_klipper.sh | 37 ++++++++++++++++++++++++++++++ scripts/remove.sh | 15 ++++++++++++ scripts/status.sh | 32 ++++++++++++++++++++++++++ scripts/ui/install_menu.sh | 9 +++++--- scripts/ui/remove_menu.sh | 12 ++++++---- scripts/ui/update_menu.sh | 5 +++- scripts/update.sh | 7 ++++++ 9 files changed, 117 insertions(+), 9 deletions(-) create mode 100755 scripts/install_pgc_for_klipper.sh diff --git a/README.md b/README.md index 101d02c..11a6052 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,12 @@ https://github.com/OctoPrint/OctoPrint --- +### **๐Ÿ”ฌPrettyGCode for Klipper** by [Kragrathea](https://github.com/Kragrathea) : + +https://github.com/Kragrathea/pgcode + +--- + ## **โ“ FAQ** **_Q: Can i use this script to install multiple instances of Klipper on the same Pi? (Multisession?)_** diff --git a/docs/changelog.md b/docs/changelog.md index abaa672..cccbea7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,9 @@ This document covers possible important changes to KIAUH. +### 2021-08-10 +* KIAUH now supports the installation of the "PrettyGCode for Klipper" GCode-Viewer created by [Kragrathea](https://github.com/Kragrathea)! Installation, updating and removal are possible with KIAUH. For more details to this cool piece of software, please have a look here: https://github.com/Kragrathea/pgcode + ### 2021-07-10 * The NGINX configuration files got updated to be in sync with MainsailOS and FluiddPi. Issues with the NGINX service not starting up due to wrong configuration should be resolved now. To get the updated configuration files, please remove Moonraker and Mainsail / Fluidd with KIAUH first and then re-install it. An automated file check for those configuration files might follow in the future which then automates updating those files if there were important changes. diff --git a/scripts/install_pgc_for_klipper.sh b/scripts/install_pgc_for_klipper.sh new file mode 100755 index 0000000..36982be --- /dev/null +++ b/scripts/install_pgc_for_klipper.sh @@ -0,0 +1,37 @@ +### base variables +PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode" +PGC_DIR="${HOME}/pgcode" + +install_pgc_for_klipper(){ + pgconfsrc="$PGC_DIR/pgcode.local.conf" + pgconf="/etc/nginx/sites-available/pgcode.local.conf" + pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf" + pgc_default_port="7136" + + status_msg "Installing PrettyGCode for Klipper ..." + ### let the user decide which port is used + echo -e "${cyan}\n###### On which port should PrettyGCode run? (Default: $pgc_default_port)${default} " + read -e -p "${cyan}###### Port:${default} " -i "$pgc_default_port" pgc_custom_port + ### check nginx dependency + dep=(nginx) + dependency_check + ### clone repo + [ -d $PGC_DIR ] && rm -rf $PGC_DIR + cd ${HOME} && git clone $PGC_FOR_KLIPPER_REPO + ### copy nginx config into destination directory + sudo cp $pgconfsrc $pgconf + ### replace default pi user in case the user is called different + sudo sed -i "s|/home/pi/pgcode;|/home/${USER}/pgcode;|" $pgconf + ### replace default port + if [ $pgc_custom_port != $pgc_default_port ]; then + sudo sed -i "s|listen $pgc_default_port;|listen $pgc_custom_port;|" $pgconf + sudo sed -i "s|listen \[::\]:$pgc_default_port;|listen \[::\]:$pgc_custom_port;|" $pgconf + fi + ### create symlink + [ ! -L $pgconfsl ] && sudo ln -s $pgconf $pgconfsl + sudo systemctl restart nginx + ### show URI + pgc_uri="http://$(hostname -I | cut -d" " -f1):$pgc_custom_port" + echo -e "${cyan}\nโ— Accessible via:${default} $pgc_uri" + ok_msg "PrettyGCode for Klipper installed!\n" +} \ No newline at end of file diff --git a/scripts/remove.sh b/scripts/remove.sh index 77c47bd..bc6827b 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -439,4 +439,19 @@ remove_mjpg-streamer(){ [ -L "${HOME}/klipper_logs/webcamd.log" ] && rm -f "${HOME}/klipper_logs/webcamd.log" CONFIRM_MSG="MJPG-Streamer successfully removed!" +} + +remove_prettygcode(){ + pgconf="/etc/nginx/sites-available/pgcode.local.conf" + pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf" + if [ -d ${HOME}/pgcode ] || [ -f $pgconf ] || [ -L $pgconfsl ]; then + status_msg "Removing PrettyGCode for Klipper ..." + rm -rf ${HOME}/pgcode + sudo rm -f $pgconf + sudo rm -f $pgconfsl + sudo systemctl restart nginx + CONFIRM_MSG="PrettyGCode for Klipper successfully removed!" + else + ERROR_MSG="PrettyGCode for Klipper not found!\n Skipping..." + fi } \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh index cb6a19f..c945917 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -520,6 +520,37 @@ compare_klipperscreen_versions(){ ############################################################# ############################################################# +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 +} + +compare_pgc_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")${default}" + REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}" + PGC_UPDATE_AVAIL="true" + update_arr+=(update_pgc) + else + LOCAL_PGC_COMMIT="${green}$(printf "%-12s" "$LOCAL_PGC_COMMIT")${default}" + REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}" + PGC_UPDATE_AVAIL="false" + fi +} + +############################################################# +############################################################# + #display this as placeholder if no version/commit could be fetched NONE="${red}$(printf "%-12s" "--------")${default}" @@ -533,4 +564,5 @@ ui_print_versions(){ compare_mainsail_versions compare_fluidd_versions compare_klipperscreen_versions + compare_pgc_versions } diff --git a/scripts/ui/install_menu.sh b/scripts/ui/install_menu.sh index e5a03f7..8bcd528 100755 --- a/scripts/ui/install_menu.sh +++ b/scripts/ui/install_menu.sh @@ -12,9 +12,10 @@ install_ui(){ echo -e "| Klipper API: | Other: | " echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | " echo -e "| | 7) [OctoPrint] | " - echo -e "| Klipper Webinterface: | | " - echo -e "| 3) [Mainsail] | Webcam: | " - echo -e "| 4) [Fluidd] | 8) [MJPG-Streamer] | " + echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | " + echo -e "| 3) [Mainsail] | | " + echo -e "| 4) [Fluidd] | Webcam: | " + echo -e "| | 9) [MJPG-Streamer] | " echo -e "| | | " quit_footer } @@ -39,6 +40,8 @@ install_menu(){ 7) do_action "octoprint_setup_dialog" "install_ui";; 8) + do_action "install_pgc_for_klipper" "install_ui";; + 9) do_action "install_mjpg-streamer" "install_ui";; Q|q) clear; main_menu; break;; diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh index 48eb07d..873674a 100755 --- a/scripts/ui/remove_menu.sh +++ b/scripts/ui/remove_menu.sh @@ -13,10 +13,10 @@ remove_ui(){ echo -e "| Klipper API: | Other: | " echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | " echo -e "| | 7) [OctoPrint] | " - echo -e "| Klipper Webinterface: | 8) [NGINX] | " - echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | " + echo -e "| Klipper Webinterface: | 8) [MJPG-Streamer] | " + echo -e "| 3) [Mainsail] | 9) [PrettyGCode] | " echo -e "| 4) [Fluidd] | | " - echo -e "| | | " + echo -e "| | 10) [NGINX] | " quit_footer } @@ -40,9 +40,11 @@ remove_menu(){ 7) do_action "remove_octoprint" "remove_ui";; 8) - do_action "remove_nginx" "remove_ui";; - 9) do_action "remove_mjpg-streamer" "remove_ui";; + 9) + do_action "remove_prettygcode" "remove_ui";; + 10) + do_action "remove_nginx" "remove_ui";; Q|q) clear; main_menu; break;; *) diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index 5306836..7fe52a6 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -21,8 +21,9 @@ update_ui(){ echo -e "| Other: |---------------|--------------| " echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | " echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | " + echo -e "| 8) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | " echo -e "| |------------------------------| " - echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | " + echo -e "| 9) [System] | $DISPLAY_SYS_UPDATE | " quit_footer } @@ -49,6 +50,8 @@ update_menu(){ 7) do_action "update_dwc2" "update_ui";; 8) + do_action "update_pgc_for_klipper" "update_ui";; + 9) do_action "update_system" "update_ui";; a) do_action "update_all" "update_ui";; diff --git a/scripts/update.sh b/scripts/update.sh index 4dc8276..0f795aa 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -303,6 +303,13 @@ update_klipperscreen(){ start_klipperscreen } +update_pgc_for_klipper(){ + PGC_DIR="${HOME}/pgcode" + status_msg "Updating PrettyGCode for Klipper ..." + cd $PGC_DIR && git pull + ok_msg "Update complete!" +} + update_system(){ status_msg "Updating System ..." sudo apt-get update && sudo apt-get upgrade -y From 969d3b5dab9abe7641490ad6b9c292624d8f6c08 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Wed, 25 Aug 2021 10:05:31 +0200 Subject: [PATCH 46/47] script: add `--allow-releaseinfo-change` option to apt-get update --- scripts/dwc2-for-klipper-socket-installer/install-debian.sh | 2 +- scripts/dwc2-for-klipper-socket-installer/install-octopi.sh | 2 +- scripts/functions.sh | 2 +- scripts/install_dwc2.sh | 2 +- scripts/install_klipper.sh | 2 +- scripts/install_moonraker.sh | 2 +- scripts/update.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/dwc2-for-klipper-socket-installer/install-debian.sh b/scripts/dwc2-for-klipper-socket-installer/install-debian.sh index 86fd8f3..8012c58 100755 --- a/scripts/dwc2-for-klipper-socket-installer/install-debian.sh +++ b/scripts/dwc2-for-klipper-socket-installer/install-debian.sh @@ -27,7 +27,7 @@ install_packages() # Update system package info report_status "Running apt-get update..." - sudo apt-get update + sudo apt-get update --allow-releaseinfo-change # Install desired packages report_status "Installing packages..." diff --git a/scripts/dwc2-for-klipper-socket-installer/install-octopi.sh b/scripts/dwc2-for-klipper-socket-installer/install-octopi.sh index c486155..92dd280 100755 --- a/scripts/dwc2-for-klipper-socket-installer/install-octopi.sh +++ b/scripts/dwc2-for-klipper-socket-installer/install-octopi.sh @@ -25,7 +25,7 @@ install_packages() # Update system package info report_status "Running apt-get update..." - sudo apt-get update + sudo apt-get update --allow-releaseinfo-change # Install desired packages report_status "Installing packages..." diff --git a/scripts/functions.sh b/scripts/functions.sh index 4424f0c..3a56233 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -234,7 +234,7 @@ dependency_check(){ echo -e "${cyan}โ— $element ${default}" done echo - sudo apt-get update && sudo apt-get install ${inst[@]} -y + sudo apt-get update --allow-releaseinfo-change && sudo apt-get install ${inst[@]} -y ok_msg "Dependencies installed!" #clearing the array unset inst diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 3bcb491..f45de5c 100755 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -174,7 +174,7 @@ install_dwc_packages() # Update system package info status_msg "Running apt-get update..." - sudo apt-get update + sudo apt-get update --allow-releaseinfo-change # Install desired packages status_msg "Installing packages..." diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 316ca06..a3b4643 100755 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -65,7 +65,7 @@ install_klipper_packages(){ ### Update system package info status_msg "Running apt-get update..." - sudo apt-get update + sudo apt-get update --allow-releaseinfo-change ### Install desired packages status_msg "Installing packages..." diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index 5a9f973..c8b5e15 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -157,7 +157,7 @@ install_moonraker_packages(){ ### Update system package info status_msg "Running apt-get update..." - sudo apt-get update + sudo apt-get update --allow-releaseinfo-change ### Install desired packages status_msg "Installing packages..." diff --git a/scripts/update.sh b/scripts/update.sh index 0f795aa..1eabccc 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -312,7 +312,7 @@ update_pgc_for_klipper(){ update_system(){ status_msg "Updating System ..." - sudo apt-get update && sudo apt-get upgrade -y + sudo apt-get update --allow-releaseinfo-change && sudo apt-get upgrade -y ok_msg "Update complete! Check the log above!" ok_msg "KIAUH won't do any dist-upgrades!\n" } \ No newline at end of file From 14ef39b87c6089ad37285738387124cf47c18465 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Wed, 25 Aug 2021 10:14:05 +0200 Subject: [PATCH 47/47] fix: typo and missing function call for PrettyGCode --- scripts/status.sh | 2 +- scripts/update.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/status.sh b/scripts/status.sh index c945917..e82938f 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -540,7 +540,7 @@ compare_pgc_versions(){ LOCAL_PGC_COMMIT="${yellow}$(printf "%-12s" "$LOCAL_PGC_COMMIT")${default}" REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}" PGC_UPDATE_AVAIL="true" - update_arr+=(update_pgc) + update_arr+=(update_pgc_for_klipper) else LOCAL_PGC_COMMIT="${green}$(printf "%-12s" "$LOCAL_PGC_COMMIT")${default}" REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}" diff --git a/scripts/update.sh b/scripts/update.sh index 1eabccc..9ed856e 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -39,6 +39,9 @@ update_all(){ if [ "$KLIPPERSCREEN_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}โ— KlipperScreen${default} |" fi + if [ "$PGC_UPDATE_AVAIL" = "true" ]; then + echo -e "| ${cyan}โ— PrettyGCode for Klipper${default} |" + fi if [ "$SYS_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}โ— System${default} |" fi