Add checks for octoprint service when installing DWC2/Mainsail

This commit is contained in:
th33xitus
2020-07-15 22:02:42 +02:00
parent 182164af9c
commit 57d86b9ef4
3 changed files with 24 additions and 8 deletions

View File

@@ -220,15 +220,23 @@ flash_mcu(){
start_klipper
}
enable_octoprint_service(){
status_msg "Octoprint Service is disabled! Enabling now ..."
sudo systemctl enable octoprint -q && sudo systemctl start octoprint
}
disable_octoprint_service(){
status_msg "Octoprint Service is enabled! Disabling now ..."
sudo systemctl stop octoprint && sudo systemctl disable octoprint -q
}
toggle_octoprint_service(){
if systemctl is-enabled octoprint.service -q; then
status_msg "Service is enabled! Disabling now ..."
sudo systemctl stop octoprint && sudo systemctl disable octoprint -q
disable_octoprint_service
sleep 2
CONFIRM_MSG=" Octoprint Service is now >>> DISABLED <<< !"
else
status_msg "Service is disabled! Enabling now ..."
sudo systemctl enable octoprint -q && sudo systemctl start octoprint
enable_octoprint_service
sleep 2
CONFIRM_MSG=" Octoprint Service is now >>> ENABLED <<< !"
fi

View File

@@ -5,11 +5,15 @@
dwc2_install_routine(){
if [ -d $KLIPPER_DIR ]; then
# check for existing installation
if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then
ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..."
return
fi
if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then
ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..."
return
fi
stop_klipper
#disable octoprint service if installed
if systemctl is-enabled octoprint.service -q; then
disable_octoprint_service
fi
install_tornado
install_dwc2fk && dwc2fk_cfg
install_dwc2

View File

@@ -4,6 +4,10 @@ mainsail_install_routine(){
dep=(wget curl unzip)
dep_check
#execute operation
#disable octoprint service if installed
if systemctl is-enabled octoprint.service -q; then
disable_octoprint_service
fi
disable_wrong_webserver
remove_wrong_webserver
install_moonraker