mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-24 00:03:42 +05:00
feat(klipper): allow keeping klipper and klipper-env dir during uninstall
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -195,11 +195,17 @@ def set_instance_suffix(
|
|||||||
def remove_single_instance(
|
def remove_single_instance(
|
||||||
instance_manager: InstanceManager, instance_list: List[Klipper]
|
instance_manager: InstanceManager, instance_list: List[Klipper]
|
||||||
) -> None:
|
) -> None:
|
||||||
|
question = f"Delete {KLIPPER_DIR} and {KLIPPER_ENV_DIR}?"
|
||||||
|
del_remnants = get_confirm(question, allow_go_back=True)
|
||||||
|
if del_remnants is None:
|
||||||
|
Logger.print_info("Exiting Klipper Uninstaller ...")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
instance_manager.current_instance = instance_list[0]
|
instance_manager.current_instance = instance_list[0]
|
||||||
instance_manager.stop_instance()
|
instance_manager.stop_instance()
|
||||||
instance_manager.disable_instance()
|
instance_manager.disable_instance()
|
||||||
instance_manager.delete_instance(del_remnants=True)
|
instance_manager.delete_instance(del_remnants=del_remnants)
|
||||||
instance_manager.reload_daemon()
|
instance_manager.reload_daemon()
|
||||||
except (OSError, subprocess.CalledProcessError):
|
except (OSError, subprocess.CalledProcessError):
|
||||||
Logger.print_error("Removing instance failed!")
|
Logger.print_error("Removing instance failed!")
|
||||||
@@ -215,22 +221,26 @@ def remove_multi_instance(
|
|||||||
options.extend(["a", "A", "b", "B"])
|
options.extend(["a", "A", "b", "B"])
|
||||||
|
|
||||||
selection = get_selection_input("Select Klipper instance to remove", options)
|
selection = get_selection_input("Select Klipper instance to remove", options)
|
||||||
print(selection)
|
|
||||||
|
|
||||||
if selection == "b".lower():
|
if selection == "b".lower():
|
||||||
return
|
return
|
||||||
elif selection == "a".lower():
|
elif selection == "a".lower():
|
||||||
|
question = f"Delete {KLIPPER_DIR} and {KLIPPER_ENV_DIR}?"
|
||||||
|
del_remnants = get_confirm(question, allow_go_back=True)
|
||||||
|
if del_remnants is None:
|
||||||
|
Logger.print_info("Exiting Klipper Uninstaller ...")
|
||||||
|
return
|
||||||
|
|
||||||
Logger.print_info("Removing all Klipper instances ...")
|
Logger.print_info("Removing all Klipper instances ...")
|
||||||
for instance in instance_list:
|
for instance in instance_list:
|
||||||
instance_manager.current_instance = instance
|
instance_manager.current_instance = instance
|
||||||
instance_manager.stop_instance()
|
instance_manager.stop_instance()
|
||||||
instance_manager.disable_instance()
|
instance_manager.disable_instance()
|
||||||
instance_manager.delete_instance(del_remnants=True)
|
instance_manager.delete_instance(del_remnants=del_remnants)
|
||||||
else:
|
else:
|
||||||
instance = instance_list[int(selection)]
|
instance = instance_list[int(selection)]
|
||||||
Logger.print_info(
|
log = f"Removing Klipper instance: {instance.get_service_file_name()}"
|
||||||
f"Removing Klipper instance: {instance.get_service_file_name()}"
|
Logger.print_info(log)
|
||||||
)
|
|
||||||
instance_manager.current_instance = instance
|
instance_manager.current_instance = instance
|
||||||
instance_manager.stop_instance()
|
instance_manager.stop_instance()
|
||||||
instance_manager.disable_instance()
|
instance_manager.disable_instance()
|
||||||
|
|||||||
Reference in New Issue
Block a user