fix: better check for still existing services during removal

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-08-31 08:17:59 +02:00
parent e26315f469
commit 535c50a3ac
2 changed files with 5 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ from core.logger import Logger
from utils.fs_utils import run_remove_routines from utils.fs_utils import run_remove_routines
from utils.input_utils import get_selection_input from utils.input_utils import get_selection_input
from utils.instance_utils import get_instances from utils.instance_utils import get_instances
from utils.sys_utils import unit_file_exists
def run_klipper_removal( def run_klipper_removal(
@@ -35,7 +36,7 @@ def run_klipper_removal(
else: else:
Logger.print_info("No Klipper Services installed! Skipped ...") Logger.print_info("No Klipper Services installed! Skipped ...")
if (remove_dir or remove_env) and klipper_instances: if (remove_dir or remove_env) and unit_file_exists("klipper", suffix="service"):
Logger.print_info("There are still other Klipper services installed:") Logger.print_info("There are still other Klipper services installed:")
Logger.print_info(f"'{KLIPPER_DIR}' was not removed.", prefix=False) Logger.print_info(f"'{KLIPPER_DIR}' was not removed.", prefix=False)
Logger.print_info(f"'{KLIPPER_ENV_DIR}' was not removed.", prefix=False) Logger.print_info(f"'{KLIPPER_ENV_DIR}' was not removed.", prefix=False)

View File

@@ -19,6 +19,7 @@ from core.logger import Logger
from utils.fs_utils import run_remove_routines from utils.fs_utils import run_remove_routines
from utils.input_utils import get_selection_input from utils.input_utils import get_selection_input
from utils.instance_utils import get_instances from utils.instance_utils import get_instances
from utils.sys_utils import unit_file_exists
def run_moonraker_removal( def run_moonraker_removal(
@@ -37,7 +38,8 @@ def run_moonraker_removal(
else: else:
Logger.print_info("No Moonraker Services installed! Skipped ...") Logger.print_info("No Moonraker Services installed! Skipped ...")
if (remove_polkit or remove_dir or remove_env) and instances: delete_remaining: bool = remove_polkit or remove_dir or remove_env
if delete_remaining and unit_file_exists("moonraker", suffix="service"):
Logger.print_info("There are still other Moonraker services installed") Logger.print_info("There are still other Moonraker services installed")
Logger.print_info( Logger.print_info(
"● Moonraker PolicyKit rules were not removed.", prefix=False "● Moonraker PolicyKit rules were not removed.", prefix=False