From 5deb987b8a1fcbb339e2184a3d40d057714b621a Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 29 Jun 2021 22:58:21 +0200 Subject: [PATCH] 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"