fix: moonraker update function - check for patched klipper sysfile

This commit is contained in:
th33xitus
2020-09-03 09:55:37 +02:00
parent 9e13c2d0ea
commit 262e489d1a
3 changed files with 15 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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(){

View File

@@ -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
}