mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 19:14:27 +05:00
fix: moonraker update function - check for patched klipper sysfile
This commit is contained in:
@@ -23,7 +23,7 @@ locate_printer_cfg(){
|
||||
ok_msg "printer.cfg location: '$PRINTER_CFG'"
|
||||
else
|
||||
PRINTER_CFG=""
|
||||
warn_msg "Couldn't locate printer.cfg - File not found!"
|
||||
warn_msg "Can't read /etc/default/klipper - File not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,15 @@ moonraker_setup(){
|
||||
#backup a possible existing printer.cfg at the old location
|
||||
#and before patching in the new location
|
||||
backup_printer_cfg
|
||||
patch_klipper_sysfile
|
||||
#re-run printer.cfg location function to read the new path for the printer.cfg
|
||||
locate_printer_cfg
|
||||
echo
|
||||
ok_msg "Moonraker successfully installed!"
|
||||
}
|
||||
|
||||
patch_klipper_sysfile(){
|
||||
status_msg "Checking /etc/default/klipper for necessary entries ..."
|
||||
#patching new printer.cfg location to /etc/default/klipper
|
||||
if ! grep -q "/klipper_config/printer.cfg" $KLIPPER_SERVICE2; then
|
||||
status_msg "Patching new printer.cfg location to /etc/default/klipper ..."
|
||||
@@ -229,10 +238,8 @@ moonraker_setup(){
|
||||
sudo sed -i "/KLIPPY_ARGS/s/\.log/\.log -a \/tmp\/klippy_uds/" $KLIPPER_SERVICE2
|
||||
ok_msg "Patching done!"
|
||||
fi
|
||||
#re-run printer.cfg location function to read the new path for the printer.cfg
|
||||
locate_printer_cfg
|
||||
ok_msg "Check complete!"
|
||||
echo
|
||||
ok_msg "Moonraker successfully installed!"
|
||||
}
|
||||
|
||||
check_for_folder_moonraker(){
|
||||
|
||||
@@ -70,6 +70,10 @@ update_moonraker(){
|
||||
else
|
||||
cd $MOONRAKER_DIR && git pull
|
||||
fi
|
||||
#read default printer.cfg location for the patch function
|
||||
locate_printer_cfg
|
||||
#patch /etc/default/klipper if entries don't match
|
||||
patch_klipper_sysfile
|
||||
ok_msg "Update complete!"
|
||||
start_moonraker && sleep 2 && start_klipper
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user