refactor: remove update_log_path function
- was introduced due to a change in moonraker in may 2021. as it is now almost 12 month ago, there is likely no need for it anymore. it can probably be assumed that every user now has updated services and configs by now. Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -349,7 +349,6 @@ function update_klipper(){
|
||||
### install possible new python dependencies
|
||||
/bin/bash "${KLIPPY_ENV}/bin/pip" install -r "${KLIPPER_DIR}/scripts/klippy-requirements.txt"
|
||||
fi
|
||||
update_log_paths "klipper"
|
||||
ok_msg "Update complete!"
|
||||
do_action_service "restart" "klipper"
|
||||
}
|
||||
|
||||
@@ -406,7 +406,6 @@ function update_moonraker(){
|
||||
### required due to https://github.com/Arksine/moonraker/issues/349
|
||||
moonraker_polkit
|
||||
|
||||
update_log_paths "moonraker"
|
||||
ok_msg "Update complete!"
|
||||
do_action_service "restart" "moonraker"
|
||||
}
|
||||
@@ -471,56 +470,4 @@ function compare_moonraker_versions(){
|
||||
MOONRAKER_UPDATE_AVAIL="false"
|
||||
fi
|
||||
echo "${versions}"
|
||||
}
|
||||
|
||||
#==================================================#
|
||||
#==================== HELPERS =====================#
|
||||
#==================================================#
|
||||
|
||||
function 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"
|
||||
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
|
||||
|
||||
# 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"
|
||||
|
||||
# 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
|
||||
}
|
||||
Reference in New Issue
Block a user